A lightweight real-time multi-client terminal chat application built with Python, TCP sockets, and multithreading.
This project demonstrates the fundamentals of client-server communication, concurrent networking, and socket programming by allowing multiple users to communicate through a central server in real time.
- Real-time messaging
- Multi-client support
- TCP socket communication
- Multithreaded server
- Join and leave notifications
- Display currently connected participants
- Chat history logging
- Simple terminal interface
- Clean and modular code structure
python-multiclient-chat/
│
├── server.py # Starts the chat server
├── client.py # Connects to the server
├── chat_history.txt # Automatically generated chat log
└── README.md
- The server starts and listens for incoming connections.
- Clients connect to the server using TCP sockets.
- Each connected client is handled in a separate thread.
- Messages received by the server are broadcast to all connected clients.
- All chat activity is logged with timestamps.
- Python 3
- Socket Programming
- TCP/IP Networking
- Multithreading
- Client-Server Architecture
git clone https://github.com/KSatyamLabs/python-multiclient-chat.git
cd python-multiclient-chatpython server.pyOpen a new terminal for each client.
python client.pyEnter a username and start chatting.
Server
Server listening on 127.0.0.1:1060
New connection from ('127.0.0.1', 52140)
Client 1
Enter your name: Alice
Alice: Hello everyone!
Client 2
Server: Alice has joined the chat.
Alice: Hello everyone!
- LAN support
- Internet-based communication
- GUI interface
- Private messaging
- User authentication
- File sharing
- End-to-end encryption
- Database support
- Asyncio implementation
- Cross-platform desktop application
This project helped me understand:
- TCP socket programming
- Client-server communication
- Multithreading in Python
- Network message broadcasting
- Handling multiple concurrent connections
- Exception handling in network applications
Suggestions and improvements are always welcome.
Feel free to open an issue or submit a pull request.
This project is licensed under the MIT License.