Search code examples
androidmobiletcp

Does TCP support the option to keep the connection when IP changes?


I want to maintain a TCP connection even if IP changes in mobile environment. Is there any option which support keeping connection when IP is changed on TCP?

I have checked the methods provided by the Java Socket class.


Solution

  • A TCP connection is identified by a five-tuple, source IP, source port, protocol, dest IP, dest port.

    So when the IP changes, the TCP connection changes.

    I want to maintain a TCP connection even if IP changes

    Is an active TCP connection really what you need? You may have to use or implement another stateless/connectionless transport layer protocol, for example UDP.