Skip to content

Latest commit

Β 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Multi-Threaded TCP Chat System

A high-performance, concurrent Chat Server and Client built in C for Linux. This project demonstrates core systems programming concepts including multi-threading, socket I/O, and inter-process synchronization.

πŸš€ Key Features

  • Concurrent Server: Handles multiple simultaneous client connections using pthreads.
  • User Authentication: Secure registration and login system with persistent storage.
  • Thread Safety: Uses pthread_mutex to protect shared resources and global client lists.
  • File Integrity: Implements flock (advisory locking) to prevent race conditions during database writes.
  • Modular Architecture: Clean separation of concerns between authentication, chat logic, and UI handlers.
  • Graceful Shutdown: Handles SIGINT and SIGTERM to clean up resources and close sockets properly.

πŸ› οΈ Technical Stack

  • Language: C (Standard C99/C11)
  • Networking: BSD Sockets (TCP/IP)
  • Concurrency: POSIX Threads
  • Build System: GNU Make
  • OS: Linux (tested on Ubuntu/WSL)

πŸ“‚ Project Structure

.
β”œβ”€β”€ Makefile            # Automated build script
β”œβ”€β”€ include/            # Header files (.h)
β”‚   β”œβ”€β”€ common.h        # Shared structures and packet types
β”‚   β”œβ”€β”€ server.h        # Server-side declarations
β”‚   └── client.h        # Client-side declarations
β”œβ”€β”€ src/                # Source files (.c)
β”‚   β”œβ”€β”€ server/         # Auth manager, chat logic, and main server loop
β”‚   └── client/         # UI handlers and main client loop
└── README.md

About

Multi-threaded TCP Chat Room using POSIX threads, Socket programming, and Advisory File Locking in Linux.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages