Over at Boy Genius Report there's been a post yesterday about how to keep a data connection alive on S60 devices over some time of inactivity. Unfortunately, the conclusions drawn there are technically not quite correct. So, as there is probably some interest in the community of how always-on connections work over GPRS and UMTS from a lower layer point of view, I've put together a summary to show what is really going on.
When you power up an S60 mobile for the first time, it is usually configured to only establish what is referred to as a "packet data connection" when needed. The term "packet data connection" however, is grossly misleading. When set this way, the mobile will only attach to the voice part of the network but will not make itself known to the GPRS packet switched side of the network. An S60 device shows this state, referred to as GPRS detached, by showing a little antenna symbol below the signal strength bars at the top left of the screen.
When the "packet data connection" option is set to "when available", the mobile performs a GPRS attach procedure as soon as it is switched on. This means that the mobile in addition to becoming known to the voice part of the network also becomes known to the GPRS part of the network. An S60 device shows this state to the user by showing two little dashed horizontal arrows below the signal strength bars. If the network supports EDGE, a little E is shown in addition above the arrows. This is shown in the picture on the left. If UMTS is supported, 3G is displayed above the arrows. In this state, and this is the crucial point here, the mobile device is NOT connected to the Internet, i.e. it has no IP address. Hence, the user is not charged and it has nothing to do with always-on connectivity.
So what's the use of this state? Not a lot actually. In the past, it was envisaged that applications from the Internet could trigger an IP connection being established to the mobile device when packets for it are received. However, to the best of my knowledge, no operator has ever made use of this functionality as it is pretty much obsolete due to the real always-on connectivity described just below. It's only real benefits are that the user sees on the display if EDGE is available or not, and that Internet connections are established faster in a subsequent step because the mobile is already registered.
In terms of power consumption, being GPRS attached should not require any more power than if one only attaches to GPRS when establishing an Internet connection if the network operator has configured the network accordingly. In practice, many network operators these days use an interface between the circuit and packet switched part of the network (the Gs interface between the MSC and the SGSN) so the mobile registers only once to the network when it is powered on and not to each part of the network individually. Also, periodic location update timers are set to the same value for the circuit and packet switched part so there is no additional signaling involved for being GPRS attached.
PDP Context Activated
Once an application wants to access the Internet for the first time, an IP address is requested from the network. This procedure is referred to as "PDP (Packet Data Protocol) context activation". Once an IP address has been acquired, the horizontal arrows at the top left of the screen changes from dashed to solid. The IP connection stays in place until one of two things happen. When the user closes an application that has requested an IP connection and no other applications are still running that use the connection as well, the IP address is released and the two arrows go back to their dashed state (GPRS Attached). But until this happens, the IP address remains assigned even if the application doesn't transfer any data. There is no technical limit of how long an IP address can stay assigned without exchanging data, it can persist for days, weeks or years. In practice, however, some (but not all) operators reset all IP connections once every 24h or after some time of inactivity. There are also operators who don't have their network properly configured so it can also happen that the IP connection is dropped when moving through the network and neighbor relationships are not properly set or if a core network component (SGSN or GGSN) malfunctions and is rebooted. However, those are exceptions.
A little Mystery
In the picture on the left there is a second option in that GPRS Attached/Detached configuration menu which is called "Access Point". I am a little bit puzzled what this option could be good for as it doesn't change the behavior of my N95 no matter whether it is set to "none" per default, to an APN or to a profile name.
The summary of this somewhat long text is that the description in the Boy Genius post is not accurate. The post suggest that by changing these options, the mobile will be switched to an always-on state and that the data connection will be kept. The only thing these options do is toggle between GPRS Detached and GPRS Attached state. The assignment of an IP address (PDP context activation) is a separate procedure, completely independent of these settings.
As a consequence, the "Packet Data Connection" option does not make anything better or worse if one has an unlimited data plan, or if one is billed per kilobyte or by the minute. Since it only speeds up getting an IP address when the first application that uses a connection requests data for the very first time, the setting should be the same for all kinds of data plans: "when available".