This project is a real-time chat application built using Python’s socket and threading libraries, along with a Tkinter-based GUI for the client interface.
It enables multiple clients to connect to a single server and exchange messages instantly.
Chat-System/ │ ├── server.py # Handles all incoming client connections and message broadcasting ├── client.py # Provides GUI interface for chatting └── README.md # Documentation (this file)
- Creates a TCP socket to listen for incoming connections.
- Uses multi-threading to handle multiple clients concurrently.
- Broadcasts each message to all connected clients.
- Gracefully removes disconnected clients to maintain stability.
- Connects to the server using its IP and port number.
- Provides a Tkinter GUI where users can type and send messages.
- Uses a separate thread to receive incoming messages asynchronously.
- Displays chat history in a scrollable text area.
python3 server.pyYou should see a message like:
Server started on IP 127.0.0.1 and port 55555
Waiting for connections...Enter your username when prompted and start chatting!
⸻
- Real-time chat communication
- Multi-client support via threading
- Simple and elegant Tkinter GUI
- Message broadcasting to all users
- Handles client disconnections gracefully
⸻
- Socket Programming: Used TCP sockets to enable communication between server and clients.
- Concurrency: Used Python’s threading module so that each client runs independently
- GUI Design: Built with Tkinter, ensuring smooth message sending and real-time updates.
- Problem Handling: Implemented safe socket closure and message queue handling to prevent crashes.
⸻
Server Terminal:
New connection: 127.0.0.1
User joined: Alice
Message from Bob: Hello everyone!Client Window:
Alice: Hi Bob!
Bob: Hello everyone!