A simple client‑server chat application built from scratch in Python using the socket and threading modules. It supports two‑way, real‑time messaging in the terminal and demonstrates core networking and concurrency concepts.
- Features
- Prerequisites
- Getting Started
- Project Structure
- What I Learned
- Future Improvements
- Contributing
- License
- 🔄 Two‑way real‑time chat over TCP (localhost)
- 🤖 Multithreading for simultaneous send/receive
- 🌐 Client‑Server architecture using Python’s
socketAPI - 🛡️ Graceful shutdown via the
"exit"command - 📚 Clean, well‑commented code for learning and extension
- Python 3.7 or higher
- Basic familiarity with command‑line/terminal
- (Optional) Git for version control
git clone https://github.com/Ansh-1019/chat_application.git
cd chat_applicationOpen terminal 1:
python server.pyOpen terminal 2:
python client.pychat_application/
├── server.py # Starts the chat server
├── client.py # Connects as chat client
├── README.md # Project overview and instructions
└── LICENSE # MIT License-
Fundamental socket programming (AF_INET, SOCK_STREAM, bind, listen, accept, connect).
-
Multithreading in Python and thread lifecycle (start(), join()).
-
Handling I/O‑bound tasks concurrently despite the GIL.
-
Graceful error handling (using try/except) in network code.
-
Debugging real‑world issues: thread start/join errors, port conflicts, Git branch problems.
-
✅ Multi‑client support (broadcast to all clients).
-
✅ Message history storage (e.g., in a file or database).
-
✅ GUI front‑end (Tkinter, PyQt, or web-based with Flask + WebSockets).
-
✅ Encryption using SSL/TLS.
-
✅ Dockerization for easy deployment.
Contributions, issues, and feature requests are welcome!
1.Fork the repository
2.Create a feature branch (git checkout -b feature/YourFeature)
3.Commit your changes (git commit -m "Add YourFeature")
4.Push to the branch (git push origin feature/YourFeature)
5.Open a Pull Request
This project is licensed under the MIT License. See the LICENSE file for details.
Made with ❤️ by Ansh Jaiswal