This is a chat application that facilitates communication between multiple clients through a centralized server. The application is designed using socket programming and handles multiple client connections concurrently using threads.
Files • Features • How To Use • Contributions
client.c
: Implements the client-side of the chat application.server.c
: Implements the server-side of the chat application, managing multiple client connections.chat.pb-c.c
,chat.pb-c.h
: Provide protobuf-c functionality for structured message communication between clients and server.
- Multi-client Support: The server can handle multiple client connections simultaneously.
- Threaded Communication: Utilizes threads to manage client connections and maintain server responsiveness.
- Protobuf Communication: Uses protobuf for structured and efficient data serialization.
- Dynamic User Interaction: Supports real-time messaging, user status updates, and connection management.
- Robust Error Handling: Implements error checking and handling to ensure reliable operation.
To clone and run this application, you'll need WSL (Windows Subsystem for Linux) and the following tools installed on it: Git, C compiler, and POSIX threads. From your command line:
# Clone this repository
$ git clone https://github.com/bl33h/clientServerChat
# Open the project
$ cd src
# Compile the server and client
$ gcc -o server server.c chat.pb-c.c -lprotobuf-c -pthread
$ gcc -o client client.c chat.pb-c.c -lprotobuf-c -pthread
# Start the server (specify the port number)
$ ./server 12345
# In a new terminal, start a client
$ ./client 127.0.0.1 12345