How to C# Chat server programming
Network programming in windows is possible with Sockets .The Microsoft .NET framework provides two namespaces, System.Net and System.Net.Sockets for managed implementation of Internet protocols that applications can use to send or receive data over the Internet .
In the previous section C# Multi Threaded Socket Program we can see a C# Multi Threaded Server Socket Program communicate with more than one Client at the same time . But there the communication is occurred between Server to Client or Client to Server , there is no communication between Client to Client . C# Chat Server describes how to a Client can communicate with any number of Clients , currently connected to the Chat Server.
The main idea behind the C# Chat Server is that each Client send messages to the Server and the Server broadcast the message to all Clients currently connected to the Chat Server . From the following picture you can see how a C# TCP Chat Server is handling communication between Client to Client.
C# chat server example
The C# Chat Server program has two sections.
How to run Chat Server program ?
In the Client program, Enter a Chat name and click " Connect to Server " button . Then you can see the message in the Server program User " Joined Chat Room " . Similarly you can connect more than one Clients at the same time and start chatting each other. If you plan to run more than one client, it is better to copy the .exe file in separate folders and run from the .exe file.