A lightweight terminal-based two-way chat application built with Python sockets, featuring a simple client–server architecture for fast, real-time communication over TCP.
This project demonstrates a basic chat system using Python’s built-in socket module. It includes:
- A Server (waits for incoming connections)
- A Client (connects and exchanges messages with server)
Perfect for beginners learning network programming, TCP sockets and real-time communication using Python.
- 🔌 Simple TCP client–server communication
- 💬 Two-way real-time messaging
- 🖥️ Fully terminal-based interface
- 🔁 Client auto-retry until server is online
- ⚙️ Clean and well-structured code
- 📦 No external libraries required
- 🧪 Perfect for learning socket programming
Here’s the structure of the Python Terminal Chat project:
python-terminal-chat/
│── server_chat.py # Chat server implementation
│── client_chat.py # Chat client implementation
│── LICENSE
└── README.md- Python 3.7+
- Works on Windows, Linux, macOS
- No third-party libraries needed
How to use this Python Terminal Chat project:
git clone https://github.com/iamx-ariful-islam/python-terminal-chat.git
cd python-terminal-chatpython server_chat.pypython client_chat.pyOnce connected, both sides can send messages to each other in real-time.
[SERVER] Waiting for connection on 127.0.0.1:443
[SERVER] Connected with ('127.0.0.1', 58425)
Server: Hello client!
Client: Hello server![CLIENT] Trying to connect to 127.0.0.1:443
[CLIENT] Connected to server
Server: Hello client!
Client: Hello server!This project helps you understand:
- Socket creation
- Binding and listening on ports
- Accepting incoming connections
- Sending & receiving messages
- Basic error handling
- Clean client–server communication patterns
Contributions, suggestions, and feedback are always welcome! ❤️
To contribute:
- Fork the repository
- Create a new branch (
feature/new-feature) - Commit your changes
- Push and submit a Pull Request
💬 You can also open an issue if you’d like to discuss a feature or report a bug.
The MIT License (MIT)
“Good networking is about making communication simple yet real-time”
— Md. Ariful Islam