Skip to content

About

A real-time multi-client chat application built with Python, TCP sockets, and multithreading.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Multi-Client Chat

A lightweight real-time multi-client terminal chat application built with Python, TCP sockets, and multithreading.

This project demonstrates the fundamentals of client-server communication, concurrent networking, and socket programming by allowing multiple users to communicate through a central server in real time.


Features

  • Real-time messaging
  • Multi-client support
  • TCP socket communication
  • Multithreaded server
  • Join and leave notifications
  • Display currently connected participants
  • Chat history logging
  • Simple terminal interface
  • Clean and modular code structure

Project Structure

python-multiclient-chat/
│
├── server.py          # Starts the chat server
├── client.py          # Connects to the server
├── chat_history.txt   # Automatically generated chat log
└── README.md

How It Works

  1. The server starts and listens for incoming connections.
  2. Clients connect to the server using TCP sockets.
  3. Each connected client is handled in a separate thread.
  4. Messages received by the server are broadcast to all connected clients.
  5. All chat activity is logged with timestamps.

Technologies Used

  • Python 3
  • Socket Programming
  • TCP/IP Networking
  • Multithreading
  • Client-Server Architecture

Getting Started

Clone the repository

git clone https://github.com/KSatyamLabs/python-multiclient-chat.git
cd python-multiclient-chat

Start the server

python server.py

Start one or more clients

Open a new terminal for each client.

python client.py

Enter a username and start chatting.


Example

Server

Server listening on 127.0.0.1:1060
New connection from ('127.0.0.1', 52140)

Client 1

Enter your name: Alice

Alice: Hello everyone!

Client 2

Server: Alice has joined the chat.

Alice: Hello everyone!

Future Improvements

  • LAN support
  • Internet-based communication
  • GUI interface
  • Private messaging
  • User authentication
  • File sharing
  • End-to-end encryption
  • Database support
  • Asyncio implementation
  • Cross-platform desktop application

Learning Objectives

This project helped me understand:

  • TCP socket programming
  • Client-server communication
  • Multithreading in Python
  • Network message broadcasting
  • Handling multiple concurrent connections
  • Exception handling in network applications

Contributing

Suggestions and improvements are always welcome.

Feel free to open an issue or submit a pull request.


License

This project is licensed under the MIT License.

About

A real-time multi-client chat application built with Python, TCP sockets, and multithreading.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages