Skip to content

Python chatroom application supporting TCP and UDP protocols, enabling multi-client communication with message broadcast.

Notifications You must be signed in to change notification settings

soh2970/Python-chatroom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Assignment 2: TCP and UDP Chatroom Server

Overview

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).

Objective

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.

Features

  • 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.

TCP Server Highlights

  • Uses socket, select, and threading 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.

How to Run

Requirements

  • Python 3.x

Start the Server

python chatroom.py

Modify the code to start the desired protocol (TCP or UDP).

Expected Inputs and Outputs

  • Clients connect and send a username.
  • Server acknowledges or rejects based on username uniqueness.
  • Messages sent by one client are distributed to all others.

Notes

  • 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.

License

This project is part of CS 3357A - Computer Networks I at Western University. For academic use only.

About

Python chatroom application supporting TCP and UDP protocols, enabling multi-client communication with message broadcast.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages