Explainer video: [https://www.youtube.com/watch?v=efhDcUB6uKg]
The CMD Communications Code (CCC) project is a command-line chat application designed to facilitate real-time communication between a server and multiple clients over a network. It is implemented in C using the Winsock2 library, which enables reliable TCP communication. The project allows users to send and receive messages in a text-based chat environment that simulates a lightweight messaging system.
- A server program ('server.c') that listens for incoming connections from clients.
- Client programs (`client.c') that communicate with the server and exchange messages.
- Two-way messaging between server and clients with minimal delay.
- A clean user interface that keeps a conversation log.
- Both server and clients use threads to handle sending and receiving messages simultaneously, ensuring a seamless conversation experience.
- Designed for Windows, using the Winsock2 library for network connectivity.
- Can be extended to work on other platforms with minor modifications.
- Includes a Python script to automate deleting files and recompiling 'server.c' and 'client.c'.
- Server listens for incoming client connections on a specific port (default: '8080').
- When a client connects, the server creates a customized thread to handle the connection to that client.
- The server broadcasts messages from one client to all connected clients.
- Clients interact with the server using a text-based interface, where messages are displayed in real time.
- Server code (
server.c): Set up the TCP server, handle client connections, and manage message broadcasts. - Client code ('client.c'): Connects to the server and allows users to send and receive messages.
- Python automation script (
automate.py): Deletes old binary files, compiles 'server.c' and 'client.c' for quick iteration.
- C compiler:
- Install GCC (MinGW) to compile the code.
- Python:
- Make sure Python is installed to run the automation script.
- Windows operating system:
- Required for Winsock2 compatibility.
- Clone the repository:
git clone https://github.com/Mr-PeterMaged/ccc cd ccc - Run the Python automation script to clean up old binaries and compile the code:
python automate.py
- Start the server in a terminal:
./server.exe
- Start multiple clients in separate terminals:
./client.exe
- Server:
Waiting for connections... Client connected! Client: Hello, Server.
- Client1:
Connected to server! You (Client): Hello, Server. Server: Hello, Client!
