Hi.

I am wondering how basic messaging with windows Live Messenger (and other alike IM networks) works.
I cannot believe that the clients poll the server for information.
Neither can i believe that the server pushes messages to clients, because what about firewall issues? And several clients on the same network?

Thanks.

Kind Regards,
Lars

What if the client connects to the central server and maintains an open connection? Then the chat server could push messages to the client as needed without running in to a firewall.

(That is how they work)

Back in the day ICQ used to P2P but it was problematic for many reasons and has since been done away with.

Thanks for the reply!

I can see that would work theoreticly, but how would that work in practice (C# in my case)?
And does this pattern/model have a name?

Thanks!

Just client-server. In your case you would have four assemblies.
1. Client DLL Assembly
2. Client GUI App
3. Server DLL Assembly
4. Server Service App
5. Message DLL Assembly

For how you go about implementing it is up to you. You could take a C# approach and define a message class, serialize it, use remoting or WCF to send the message to the server, and then have the message relay to the appropriate client.

That approach has overhead for sending XML tags across the WAN and that few extra bytes might drive some developer nuts. If this is your case then you can define short custom commands and do the parsing yourself.

You can find a lot of chat applications on codeproject.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.