loloof64
loloof64

Reputation: 5392

Does a socket remain open even if one sides ip address changes?

If I open a socket between two computers on the WAN, while at least one of them has a dynamic ip-address, and this address changes even though the socket hasn't been explicitly closed : Do have a warranty that this socket will remain open at least until my program really asks to close it?

Regards

Upvotes: 2

Views: 1176

Answers (1)

Jason Sperske
Jason Sperske

Reputation: 30436

As soon as the IP address of one of the two computers changes then the computer that held on to the original address, (not knowing the new address) would no longer be able to communicate with the other. There is no automatic process of informing the connected clients that a new IP address has been assigned, you could conceivably create one but you would have to communicate the new address over the old IP address before you changed it. Also the other computer wouldn't immediately know that addresses had changed at all, you would have to wait until it timed out. The other big challenge is the likelihood that the computer wouldn't even know that it's own IP address had changed because on a WAN it might be exposed to the internet via a NATed addresses.

Upvotes: 4

Related Questions