简体   繁体   中英

Socket programming and dynamic IP

What would be happen if IP address is changed after connection is established? Will the connection be broken?

Suppose I am using JAVA

That depends. SCTP has some special features to permit an established connection to survive routing changes (nearly) transparently, but it's not widely available yet; I assume you're really talking about TCP.

If the address of one of the peers changes, to the extent that the other peer would need to use that different address, then no, there is no way for TCP to recover from that.

On the other hand, a router between two non-natted peers could change its address, once the new routes are established, connected peers will likely resume. As long as the routes update quickly enough, open TCP connections are likely to persist the change, but only so long as both peers have the same addresses before and after the routing change. This is actually happening all the time.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM