This project simulates the early days of networking by implementing a multi-user chatroom application using both TCP and UDP socket programming in Python. You are tasked with creating two versions of a chatroom server that allow clients to communicate in real-time: one using Transmission Control Protocol (TCP) and another using User Datagram Protocol (UDP).
To develop two concurrent server-client applications that:
- Use TCP and UDP protocols respectively.
- Handle multiple client connections in real-time.
- Support message broadcasting from the server to all connected clients.
- Manage client names and connections effectively.
- Multi-threaded server using TCP for reliable communication.
- Basic UDP-based version for lightweight messaging (to be implemented if not already).
- Concurrent handling of multiple clients.
- Unique username enforcement.
- Real-time broadcast of chat messages to all connected users.
- Graceful client connection and disconnection.
- Uses
socket
,select
, andthreading
modules. - Each client provides a username; duplicates are rejected.
- Incoming messages are broadcast to all connected clients.
- Clients are handled concurrently using threads.
- Server listens and accepts connections with timeout using
select.select
.
- Python 3.x
python chatroom.py
Modify the code to start the desired protocol (TCP or UDP).
- Clients connect and send a username.
- Server acknowledges or rejects based on username uniqueness.
- Messages sent by one client are distributed to all others.
- Only TCP is implemented in the current code. UDP support may require a parallel implementation.
- Username management ensures each participant is uniquely identified.
- This implementation is suitable for LAN-based chat simulations and educational purposes.
This project is part of CS 3357A - Computer Networks I at Western University. For academic use only.