简体   繁体   English

套接字编程和动态IP

[英]Socket programming and dynamic IP

What would be happen if IP address is changed after connection is established? 建立连接后更改IP地址会发生什么? Will the connection be broken? 连接会断开吗?

Suppose I am using JAVA 假设我正在使用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; SCTP具有一些特殊功能,可以使已建立的连接透明地(几乎)透明地承受路由更改,但尚未广泛使用。 I assume you're really talking about TCP. 我认为您真的在谈论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. 如果对等方之一的地址发生更改(以至于另一对等方需要使用该不同的地址),则不会,TCP无法从该地址恢复。

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. 只要路由更新足够快,打开的TCP连接就可以保留更改,但前提是两个对等方在路由更改前后都具有相同的地址。 This is actually happening all the time. 这实际上一直在发生。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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