Skip to content

Latest commit

 

History

History
63 lines (44 loc) · 1.24 KB

File metadata and controls

63 lines (44 loc) · 1.24 KB

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