And the Windows Mobile Connection Manager said: "Do you care for an IP connection?"
This is the second post of the introduction to the Windows Mobile Connection Manager. In part I (Portuguese only, sorry), we talked about the myriad of networks a cell-phone can connect to: WAP, GPRS, EDGE, etc. We also briefly presented the characteristics of each of these networks.
Based on the level of complexity one can get, it would not be fair to let the end-user decide which network to use - from the user standpoint it really should not matter which connection she is using, as far as she is getting the information (website, email, IM) she needs. The Connection Manager comes to rescue managing all connections based on criteria defined by mobile operators, the type of connection (Internet, Work, WAP, Secure WAP) and settings like VPN and proxy.
Does your work connection use my Internet settings?
Let's image the user starts Internet Explorer Mobile and enters an URL, the question is: how does IE Mobile know which network/settings to use? The quick answer: it doesn't, Connection Manager does... Details?
Whenever you direct IE Mobile to open a website (entering the URL or choosing a Favorite), it requests the Connection Manager for a connection passing the URL as a parameter of this request. Based on the URL, the Connection Manager (CM) will establish the connection and send it back to IE Mobile. Actually it is not the CM that establishes the connection, but it sends the request to the core OS, the core OS talks to the Radio Interface Layer (RIL) which in turn, instructs the radio to establish the connection with the cellular network - but for now on, let's just say the CM is in charge of connecting to the network.
So the destination URL is the information CM needs to decide which settings to use. If you go to Settings, Data Connections in your Smartphone you will see 4 different settings: Internet, Work, WAP and WAP Secure - it acts like a lookup table CM checks to define the network to use and is usually configured by the Mobile Operator.
The rules, at this point, are simple:
- If the destination URL is a Full Qualified Domain Name (FQDN) or a valid IP address, the CM will use the Internet Settings to establish the connection. Usually the Mobile Operator will configure it to use one of its GPRS/EDGE settings;
- If the destination URL can not be resolved over the Internet (e.g. an intranet site/NetBIOS hostname), the CM will use the work connection settings to activate the connection;
- CM will use WAP connection settings for any URL starting with "wsp://" (instead of "http://");
- And finally, any URL with "wsps://" will trigger the Secure WAP settings while connecting to the destination.
CM would not deserve a full series of posts if it was just that. Things can get a little complicated as we can also configure VPNs, proxies and dial-up connections. For example, let's suppose I'm at the airport with my Windows Mobile-based Smartphone and I need to connect to a server inside my company intranet to check sales on a specific product. The server name is "contoso" (not very creative, right? :-) and the destination URL, http://contoso. I'm supposing the Mobile Operator has pre-configured the packet network (GPRS or EDGE) and my company's IT has created a VPN entry on my Smartphone.
I open up IE Mobile, enter the URL and hit "Go" - let's see what happens:
- IE Mobile issues a connection request to CM with the URL (http://contoso) as a parameter;
- As soon as the CM receives the request, it checks the active connections verifying if any of them satisfies the request;
- If there is no active connection that satisfies the request, CM realizes it is an intranet site and it checks for a VPN entry that would satisfy it (a VPN connecting from Internet to Intranet);
- If the VPN entry is present, CM will connect to the Internet through the Mobile Operator's packet network and will try the VPN connection;
- Once connected, it returns the connection to IE Mobile and also notifies other applications that a new connection is available.
See the picture bellow for a graphic representation of the process described.
It can get even worse... let's say that, while I'm checking the contoso intranet server, I decide to connect my MSN Messenger to IM with a manager about the current sales. As I'm "inside" my intranet, I will need a proxy entry in the Smartphone to make the internet call to the Messenger servers routed back from the intranet to the internet (that's the same behavior you'd see on a computer running Windows XP, for example).
So now, I'm connected to the Mobile Operator's GPRS network (Internet), connected to my company's Intranet through a VPN (IE Mobile) and connected back to the Internet through a proxy (MSN Messenger). That's way cool! :-)
Let's say I'm done with my Intranet checking and I want to access that nice ringtone WAP site... I point IE Mobile to "wsp://nicewapsite.com" and hit "go", what happens? The very same thing, IE issues a request to CM with the URL as the parameter and CM checks if there is an available connection that fulfills the request. But at this point we hit an interesting situation: IE needs a WAP connection (the URL begins with "wsp://") and we have a GPRS Internet connection (with VPN & proxy) up and running. In order to satisfy the last request from IE Mobile, the CM would need to shutdown the Internet connection and activate the WAP one.
And guess what? That's exactly what it does! With no fear, CM shuts down the GRPS Internet connection and opens up the WAP one (being it over CSD or GPRS - see part I). And yes, on our scenario, Messenger would immediately disconnect... By the way, this behavior changes in Windows Mobile 5.0 - in the new OS version, we have support for multiple APNs, which basically means you can have more then one connection/APN activated at the same time.
Interestingly enough, you can "see" it doing the network switch by keeping an open eye on the little "G" over the signal level icon (on the top right of your Smartphone screen): the little "G" will blink once while CM "changes" networks.
Please, see this article for the full connection process/criteria employed by the Connection Manager as well as some connection scenarios.
In the next article we will discuss why Mobile Operators & Developers should care about the Connection Manager and drill down in the technical stuff/configuration files.
Please, let me know your comments or doubts.