Skip to content

rybert79/chat_app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ’ฌ Room-Based Multi-Threaded Chat App

A lightweight, terminal-based chat application built using Python's native socket and threading libraries. This project implements a structural room system where clients can either create a new room with a custom code or join an existing one to chat in pairs.

๐Ÿš€ Features

  • Dynamic Room System: Create or join specific chat rooms using unique text codes.
  • Multi-Threaded Architecture: Handles multiple concurrent client connections without blocking the server or input streams.
  • Race-Condition Safe: Utilizes threading.Lock() to secure shared resources and prevent thread collisions.
  • Auto-Cleanup: Automatically destroys empty rooms and frees up system memory when clients disconnect.
  • Lightweight & Efficient: Low memory and CPU usage, perfect for minimal desktop environments.

๐Ÿ› ๏ธ Tech Stack & Concepts

  • Language: Python 3
  • Core Libraries: socket, threading, sys
  • Architecture: Client-Server Model, Low-Level TCP Networking, Concurrency Management.

๐Ÿ’ป How to Run

1. Start the Server

First, run the server script to start listening for incoming connections on port 5000:

python server.py

2. Launch Clients

Open two separate terminal windows and run the client script in each:

python client.py

3. Usage Flow

  • Client 1: Selects create (or type 1) -> Enters room code (e.g., rahasia).

  • Client 2: Selects join (or type 2) -> Enters the same room code (rahasia).

Chat: Once connected, type your messages and hit Enter. Type exit to safely close the connection.


About

Room-Based Multi-Threaded Chat App

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages