A simple, easy-to-use chat application built with Python sockets. Multiple clients can connect to a central server and chat with each other in real-time.
- ✅ Real-time messaging - Instant message delivery
- ✅ Multiple clients - Support for unlimited users
- ✅ User-friendly interface - Clean and simple UI
- ✅ Username system - Each user has a unique username
- ✅ Join/Leave notifications - See when users join or leave
- ✅ Timestamp messages - All messages show time
- ✅ Easy to use - Simple setup and operation
SimpleChatApp/
├── server.py # Chat server
├── client.py # Chat client
└── README.md # This file
- Python 3.6 or higher
- No additional libraries required (uses only built-in modules)
Open a terminal/command prompt and run:
python server.pyYou should see:
==================================================
💬 Simple Chat Server
==================================================
🚀 Chat Server started on 0.0.0.0:5555
Waiting for clients to connect...
Open new terminal windows for each client and run:
python client.pyFor each client:
- Enter server IP (default:
127.0.0.1) - Enter server port (default:
5555) - Enter your username
- Start chatting!
- Start server:
python server.py - Stop server: Press
Ctrl+C
- Start client:
python client.py - Send message: Just type and press Enter
- Quit chat: Type
quitor pressCtrl+C
🚀 Chat Server started on 0.0.0.0:5555
Waiting for clients to connect...
📱 New connection from ('127.0.0.1', 12345)
👤 Alice joined the chat
📱 New connection from ('127.0.0.1', 12346)
👤 Bob joined the chat
💬 Alice: Hello everyone!
💬 Bob: Hi Alice!
👋 Alice left the chat
==================================================
💬 Simple Chat Client
==================================================
Enter server details:
🌐 Server IP (default: 127.0.0.1):
🔌 Server Port (default: 5555):
✅ Connected to server at 127.0.0.1:5555
👤 Enter your username: Alice
🎉 Welcome, Alice!
💡 Type your messages below. Type 'quit' to exit.
--------------------------------------------------
🔔 Welcome to the chat, Alice! Type your messages below.
[14:30:15] You: Hello everyone!
[14:30:20] Bob: Hi Alice!
[14:30:25] You:
Edit server.py line 8:
def __init__(self, host='0.0.0.0', port=5555): # Change 5555 to your preferred portEdit server.py line 8:
def __init__(self, host='0.0.0.0', port=5555): # Change '0.0.0.0' to your IP- Local network: Use your computer's IP address (e.g.,
192.168.1.100) - Internet: Requires port forwarding on your router
- Firewall: Make sure port 5555 is allowed
- Make sure the server is running
- Check if the IP and port are correct
- Verify firewall settings
- Wait a few seconds and try again
- Or change the port number in server.py
- Check your internet connection
- Make sure you're connected to the right server
- Try restarting the client
- Protocol: TCP sockets
- Encoding: UTF-8
- Message format: JSON for structured messages
- Threading: Multi-threaded server for handling multiple clients
- Error handling: Graceful disconnection and reconnection
Feel free to improve this project by:
- Adding new features
- Fixing bugs
- Improving the UI
- Adding encryption
- Adding file sharing
This project is open source and available under the MIT License.
Happy Chatting! 🎉