This project is a basic real-time chat application built using Python's socket and threading modules. It allows multiple clients to connect to a server and exchange messages that are broadcast to all connected clients in real time.
- Real-time message broadcasting between clients.
- Supports multiple client connections to the server.
- Unique nicknames for each client.
- Messages are shared with all connected clients.
- Simple and easy-to-understand code for educational purposes.
- The server listens for incoming connections and manages all clients.
- Each client is assigned a unique nickname upon connecting.
- Clients send messages to the server, which broadcasts them to all other connected clients.
- Clients can send and receive messages simultaneously in real time.
- Python 3.x installed.
- No additional external libraries required.
-
Run the Server:
-
Open a terminal and navigate to the project directory.
-
Start the server by running: bash python server.py
-
The server listens for incoming connections on localhost:55555.
-
-
Run the Client(s):
-
Open a new terminal (repeat this to simulate multiple clients).
-
Start a client by running: bash python client.py
-
Enter a unique nickname to join the chat.
-
-
Example Workflow:
-
Start the server: bash python server.py
-
Run multiple clients: bash python client.py
-
Messages sent by one client will be received by all other clients in real time.
-
├── server.py # Server code ├── client.py # Client code └── README.md # Documentation
- Private Messaging: Add functionality for clients to send private messages.
- Encryption: Implement message encryption for secure communication.
- Graphical User Interface (GUI): Use frameworks like Tkinter or PyQt to enhance the user experience.
- Persistent Chat History: Save chat messages to a file or database for future reference.