Search code examples
androidwifi3g

What will happen to existing connections when switch between 3g/wifi


Assume that, I have a TCP connection that doing heavy data transmitting on my 3G network; and I walked home, Android switch to my home Wifi automatically. Now what happen to the existing connection? is it simply disconnect? or it will keep going, only new connections will use wifi?

In addition, what if I walk away from home, wifi lost signal and switch to 3g? It should be safe to guess the connection is dropped. For my application, do I need to handle the reconnection or there is a auto fall back solution?

Thanks in advance.

Hongbo


Solution

  • The connection will drop because your device will appear at a different IP address, which is how TCP packets find their way.

    There is no fallback unless you code it up, which you should do anyway if your app spends a lot of time on 3G. It's quite OK for desktop applications to go "D'oh!" when your Cable or DSL has the occasional hiccup, but 3G connections go down routinely.