
January 22nd, 2013, 02:19 PM
|
|
|
|
How do Instant Messengers work?
Hello,
I would like to learn more about network programming. I have been thinking about how Instant Messengers work (ex: Live Messenger).
From what I read on the Internet I understand that when I start the client on my PC this will connect with a server somewhere on the net. Like this the server knows that I am on line. I guess the server or client can poll every 30seconds to see if I am still on line (not sure of this).
What I am finding hard to understand is what happens when someone wants to chat. The most simple model I can think of is that if John wants to chat with Ben then John sends his message to the server and the server (from some header information) forwards the message to Ben.
However this means that all messages have to go through the server, the server has to process every message to see who the recipient is. This I guess would work for a few clients. However not sure if it would work for millions of clients.
Or maybe the server exposes the information of a chat client with another chat client so that these can communicate directly together?
|