I imagine MSN messenger works something like one of these two scenarios:
A) I log on, the MSN client talks to the main servers and stores some information about my current connection (ip:port). When my friend logs on, he gets his buddy list which includes my ip:port. When he sends me a message, his client uses my ip:port to talk with my client. If that fails, it asks the server for the information again (in case it changed).
B) Pretty much the same as in A but the messages are routed thru the main servers instead of going directly.
I suspect that A is more likely because of several reasons:
1) Routing thru main servers would likely result in WAY too much traffic that isn't really needed if you can make a direct connection (or unless MS wants to log all our IM conversations.)
2) Back when I used one of the earlier versions of the AOL-IM clients, I'd get into this situation where I'd be chatting with my co-worker who was on my work WAN via VPN. We'd be chatting when the AOL client would log off because of some internet disruption. Despite the apparent lack of connection to the main AOL-IM servers, I could continue chatting to my friend. The only possible way this could happend is if the client had been smart enough to discover the other client over the WAN (nothing more than a internal LAN address).
If you built a client that constantly polled a main server for messages that you wanted to act in anything close to "real-time" you'd need to poll pretty often. I'd say not less often than once every 5 seconds. This would generate an enormous amount of network traffic and strain on the webservice hosting machine for what will amount to be unneeded calls. Have you seen the contents of an HTTP webservice request? It would be considerably bulky for something that fits the nature of this topic.
POST /myMessenger.asmx HTTP/1.1
Host: myWebServer
Content-Type: text/xml; charset=utf-8
Content-Length: 999
SOAPAction: "http://www.myWebSite.com/myMessenger/GetMessages"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetMessages xmlns="http://www.myWebSite.com/myMessenger">
<gidUserGUID>guid</gidUserGUID>
</GetMessages>
</soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetMessagesResponse xmlns="http://www.myWebSite.com/myMessenger">
<GetMessagesResult>string</GetMessagesResult>
</GetMessagesResponse>
</soap:Body>
</soap:Envelope>
-
Peter