A simple console-based TCP chat application using C# and .NET. It demonstrates how to build a client-server architecture using TCP sockets with multithreading for real-time communication.
tcp-chat-app-csharp/
├── TcpChatApp.sln
├── ChatServer/
│ ├── ChatServer.cs
│ └── ChatServer.csproj
└── ChatClient/
├── ChatClient.cs
└── ChatClient.csproj
- Start the Server
Open a terminal and go to theChatServer
folder:dotnet run
You will see: Server started. Waiting for connection...
- Start the Client
Open another terminal and go to theChatClient
folder:dotnet run
Now both sides can send and receive messages in real-time!
- Open
TcpChatApp.sln
- Right-click
ChatServer
→ Set as Startup Project → Run - Then right-click
ChatClient
→ Set as Startup Project → Run - Both terminals will appear and allow two-way messaging
- C# (.NET 6+)
- TCP/IP Sockets (
System.Net.Sockets
) - Multithreading (
System.Threading
) - Console I/O
- Two-way communication (Client <--> Server)
- Real-time message exchange via TCP sockets
- Uses multithreading for simultaneous send/receive
- Support multiple clients (multi-threaded server)
- Add message encryption (e.g., SSL or AES)
- Save chat history in a database
- Add GUI using WinForms or WPF
Hariharan
🔗 Portfolio
🔗 GitHub
This project is open-source and available under the MIT License.