开发者

Hold a network connection although IP address change

Is it possible to hold an open TCP connection with a client, while the IP address of the client is externally changed? For example, the connection is establishes against address X, but somewhen whi开发者_如何学运维le the connection is open, the client-side user asks for IP renew and gets another IP address. Can the connection remains alive in this case?

Thanks in advance.


No, it cannot.

Even if the local side could be massaged to understand that the connection is suddenly between different addresses, the remote side will not understand and will refuse to work with it.

You'd need to re-add the old IP address to continue using the connection.


To do so:

Linux: ip addr add 172.16.10.20/22 dev bond0
Windows: do some pointy-clicky or**fill in command here**


This is possibe with tcp v6 connections, if you're using e.g. tunnelbrocker.net. Every time your IPv4 address changes, the connection between your IP4 address and the tunnelbrocker's IP4 address is dropped then re-established, however your IP6 attress is the same and all the TCP/IPv6 conections from your IP6 address to your destination IP6 addresses are still here.

Or, if you're designinng both your client & server, your could design your protocol allowing the client to reconnect in a transparent way..


What I know is, when using UDP, the connection can be remained, one of my application is to change a remote network adapter address via UDP.

For TCP, I agree with Soonts, you should design your server and client application to allow the reconnect in a transparent way.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜