1. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2004
    Rep Power

    How do Instant Messengers work?


    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?
  2. #2
  3. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Rep Power
    Both methods are possible, the first is easier to implement and generally more reliable. Skype uses a variation on the second method, most other networks use the first method as far as I know.

    * The reason Skype uses a peer-to-peer based model is because the bandwidth requirements for voice and video are a lot higher than for text, so it's impractical to offer a free server-based solution for it.

    Comments on this post

    • sim085 agrees : Thank you!

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around

IMN logo majestic logo threadwatch logo seochat tools logo