A multithreaded TCP chat application built in C++ using Winsock (Windows).
This project demonstrates low-level socket programming, client–server architecture, and multithreading using the Winsock API.
This application consists of:
- A TCP server that accepts multiple client connections
- Multiple TCP clients that can send and receive messages concurrently
- A broadcast mechanism where messages from one client are delivered to all others
The project is intended for learning system programming concepts and is suitable for interview discussion and resume use.
socket-programming-chat-application/ │ ├── server/ │ └── server.cpp # Multithreaded TCP chat server │ ├── client/ │ └── client.cpp # TCP chat client │ └── README.md
- TCP-based client–server communication
- Supports multiple concurrent clients
- Multithreaded server (one thread per client)
- Separate send and receive threads on client
- Real-time message broadcasting
- Graceful connection handling
- Language: C++
- Networking API: Winsock2
- Concurrency:
std::thread - Protocol: TCP (IPv4)
- Platform: Windows
- Initializes the Winsock library
- Creates and binds a TCP socket
- Listens for incoming client connections
- Accepts clients in a loop
- Spawns a new thread for each connected client
- Receives messages and broadcasts them to all connected clients
- Initializes the Winsock library
- Connects to the server using IP and port
- Uses two threads:
- One for sending messages
- One for receiving messages
- Displays incoming messages in real time
- Windows OS
- Visual Studio (or any C++ compiler with Winsock support)
- Basic knowledge of socket programming
Using Visual Studio:
- Open
server.cppproject - Build and run the server
Using command line (MinGW example):
g++ server.cpp -o server -lws2_32
server.exe