ARO: Describing network connections
In our study of applications using ARO, we often discuss the different connections that a mobile phone makes with a network. Sometimes there has been initial confusion understanding the difference between radio (phone -> tower) and TCP (data connection from the phone to the server) connections. This blog post is an attempt to explain these two types of connections, and describe how they interact.
The first step in establishing a mobile TCP connection is the establishment of a radio connection to the tower. Once the radio connection is established, a TCP connection from the phone to the server can be made.
But now what? How do these connections interact, and how to they close down? Do they close in the opposite order they opened?
In many cases that is what happens. Upon completion of data transfer, the TCP connection closes, and then the radio times out. But that is not always the case.
Sometimes there is a need for a persistent TCP connection so that data can be sent from the server to the device. (You need an open TCP connection for this to work, because then the server knows what IP to send the data to.) In this case, the TCP connection remains open, but the radio times out and goes to idle. Should the server send data to the device, the radio will turn on and complete the transaction.
What is important from a Application Optimization perspective is that only the radio connections cause battery drain. Having an open TCP connection does not affect the radio power, and therefore, does not affect the power of the device. However, to keep the TCP connection alive, you must use the TCP connection before the network firewalls close the connection (due to inactivity). On the AT&T network, this timeout is 30 minutes (and the shortest US carrier value is 4 minutes). Setting the ping rate to keep the TCP connection open is one that should be lengthened as long as possible to minimize the number of radio connections.