A desktop-based multi-client chat application built using Python, TCP sockets, multithreading, and Tkinter. The application allows multiple users to connect to a central server, communicate in real time, send private messages, and view currently connected users through a graphical interface.
- ✅ Multi-client communication using TCP sockets
- ✅ Graphical User Interface (Tkinter)
- ✅ Public group chat
- ✅ Private messaging between users
- ✅ Live online users list
- ✅ Duplicate username protection
- ✅ Join and leave notifications
- ✅ Message timestamps
- ✅ Command-based interface
- ✅ Thread-safe server handling
- ✅ Graceful client disconnection
- Python 3
- Socket Programming (TCP)
- Multithreading
- Tkinter
- Client-Server Architecture
multi-client-chat-python/
│
├── client.py
├── server.py
├── README.md
├── requirements.txt
├── .gitignore
└── screenshots/
git clone https://github.com/Stranger-Khalid/multi-client-chat-python.git
cd multi-client-chat-pythonpython server.pyThe server will begin listening on:
127.0.0.1:1234
Open another terminal (or multiple terminals):
python client.pyEnter a unique username for each client.
| Command | Description |
|---|---|
/help |
Display available commands |
/list |
View all connected users |
/msg <username> <message> |
Send a private message |
/quit |
Disconnect from the server |
+------------------+
| Server |
|------------------|
| Socket Listener |
| Client Manager |
| Message Routing |
+--------+---------+
|
-------------------------------------
| | |
+---------------+ +---------------+ +---------------+
| Client 1 | | Client 2 | | Client 3 |
| Tkinter GUI | | Tkinter GUI | | Tkinter GUI |
+---------------+ +---------------+ +---------------+
- The server listens for incoming TCP connections.
- Each client connects using a unique username.
- The server creates a separate thread for every connected client.
- Messages are broadcast to all connected users.
- Private messages are routed directly to the selected recipient.
- The online users list is synchronized automatically.
- Clients can disconnect safely using the
/quitcommand.
- Socket Programming
- TCP Communication
- Client-Server Architecture
- Multithreading
- GUI Development
- Event-Driven Programming
- Thread Synchronization
- Network Programming
- Command Parsing
- Software Design
- User authentication
- Chat rooms
- File sharing
- Message history
- Database integration
- End-to-end encryption
- Emoji support
- Dark mode
- LAN auto-discovery
- Internet-based deployment
Mohammad Khalid
GitHub: https://github.com/Stranger-Khalid
This project is developed for educational and learning purposes.


