Skip to content

abhinab-choudhury/Chat-CLI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chat CLI

Chat CLI is a simple command-line chat application built in C using sockets and pthreads. It supports multiple clients connected to a server, allowing real-time message broadcasting to all connected users.

Features

  • TCP-based IPv4 communication
  • Multi-client support via threads
  • Message broadcasting to all clients
  • Command-line interface

How It Works

  • The server listens for incoming connections.
  • Each connected client is handled on a separate thread.
  • Messages sent by one client are broadcast to all others.
  • Typing bye closes the client connection.

Build & Run

🔧 Compile Manually

Make sure you have GCC installed.

gcc server.c -o server -lpthread
gcc client.c -o client -lpthread

🛠️ Compile with CMake

Make sure you have CMake 3.10 or above:

mkdir build
cd build
cmake ..
make

This will generate two executables in the build/ directory: server and client.

▶️ Run Server

./server

💬 Run Client

./client

Project Structure

.
├── client.c         # Client source code
├── server.c         # Server source code
├── CMakeLists.txt   # CMake build configuration
├── README.md        # This file

About

Sockets in C

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors