How does Windows Live Messenger works? there are millions of users typing messages everyday but maybe few of them ever asked themselves how the messenger really works! so here I wrote a little post about it.
Windows Live Messenger it’s an hybrid Client-Server / Peer-to-Peer application.
It basically started as a client-server application.
Let’s say that the client A wants to contact the client B. The client A logs in a CS (Connection Server) through a persistent TCP connection (eventually using proxy,gateway..). Behind the CS there are the PS (Presence Server).
Each person get always the same particular PS, which is where your personal status message, description of your user photo and similar things are stored.

Another element of the architecture is the Address Book. The client A gets directly from the Address Book his list of contacts.
Then the client A tells to his CS who his friends are, the CS subscribes to his friend’s PS to get the presence information that are sent up through the client server connection.
If the client A change his status to OffLine for example, the change goes up to the CS of A, then to the PS of A, then down to the CS of B through the subscription and then down to the client B.
CHAT
If the client A wants to chat, tells to his CS that wants to contact somebody, and the CS tells A to contact a Mixer, which sends IM traffic to a destination, for example to B (passing through the CS of B). Then A and B can communicate through the Mixer.

PEER TO PEER
When the clients A and B wants to send larger pieces of data (big files, audio, video) then they use the Peer-to-Peer technology. So A and B set up a Session through the Mixer. They need to know how to set up a direct connection, secure connection, IP addresses, protocols supported, NAT or firewall’s information and so on. If the peer to peer connection fails A and B can always set up a connection through the Mixer.

For video and audio service there are specific servers with similar functions as the Mixer.
Also the data transmission between A and B (in both peer to peer or Mixer cases) is Encrypted. There is a Passport server which verify the user authentication in order to establish the connection in a safe mode. What is important to underline is that the encryption is end to end, which means it happens only in the clients A and B and not in the mixer, so it doesn’t affect performances.
OFFLINE MESSAGES
Let’s now suppose that the client B wants to send an offline message to the client A (which is actually offline). The client B sends the message to an Offline IM webserver which stores it in Hotmail. When the client A logs in, the CS will tells A that there is an offline message waiting for him and A gets it from the Offline IM webserver.

If the client A is showing himself as offline, and sends a message to the client B which is on line, the connection doesn’t go through the Offline IM webserver (that would really slow down the connection) but still through the Mixer.
YAHOO INTEROP
It is possible to add Yahoo contacts on Windows Live Messenger.
If the client A wants to contact the client Y, which is a Yahoo client, this time the connection doesn’t go through the Mixer. The client A will contact his CS, which will contact the Yahoo servers which will route to the yahoo client Y.

Windows Live Messenger’s abstractions
In the client there is an abstraction called Transport, and one called Master Session.

Any sort of feature the developers want to implement (file transfer, file sharing..) they can use this abstraction of the Transport.. so if the client A wants to contact B, it asks for a “transport” to the client B, so there is a call to the Transport and the Master Session establishes a session to the client B.
Under the Transport there are some kind of bridges to send the data.
The first one is TCP which is fast, reliable. Then there is UDP where packets though can be lost or not be delivered in order. If TCP or UDP connections fails we can always use the Mixer to send data.
The UDP uses the ARQ-1 (automatic repeat request). If the client A wants to communicate, he sends a packet to B then he waits for an acknowledgement and only if he gets it he goes on transmitting the next packet.
This is obviously a slower process compared to the TCP which uses the sliding windows algorithm for the flow control and it’s more efficient.
You can watch also an original video where some of the developers and visionaries behind Windows Live Messenger explain how it works.









Thanks its good explanation; want to know more details and specific info.
/N Roy
Excellent site, added to favorites!!A
Thanks very much, I’m from Ecuador, I’m studing Networking and I want to learn everything about that.
Now I was searching about distributions systems in the net, so I thing the messenger it’s the good example.
Well, congratulations this page is excellent !
David Y.
thank you for more information i see