A real-time client-server chat application built using C and TCP socket programming. The application enables a client to connect to a server and exchange messages reliably over a network.
- π¬ Real-time bidirectional communication
- β‘ Concurrent client handling using pthreads
- π Reliable data transmission over TCP/IP
β οΈ Error handling and graceful client disconnection- π₯οΈ Runs on Linux (Ubuntu)
- C (Socket Programming)
- TCP/IP Protocol
- POSIX Threads (pthreads)
- GCC (Compilation)
- GDB (Debugging)
- Linux (Ubuntu)
-
Clone the repository:
git clone https://github.com/SSwapnild31/chat-system-project.git
-
change directory to chat-system-project
cd chat-system-project -
Compile and create exe file called server
cc server.c -o server
-
Run the exe file with port number and ip address(127.0.0.1) - any ip & port no
./server 2000 127.0.0.1
-
Compile and create exe file called client
cc client.c -o client
-
Run the exe file with port number and ip address same as server
-
In different terminal
./client 2000 127.0.0.1
- Server creates a
socket(),binds()to a port, andlisten()for incoming connections - Multiple clients connect using TCP sockets
- Server uses pthreads to handle multiple clients concurrently as well as send/receive messages at same time
- Messages are sent and received using
send()andrecv()system calls
- Hands-on experience with TCP socket programming
- Understanding of client-server architecture
- Thread management using pthreads
- Working with Linux system calls
- Debugging using GDB
- Add private messaging between clients
- Implement authentication system
- Use
select()orpoll()for I/O multiplexing - Add logging and message history
- Improve scalability using epoll (Linux)
-
Server
-
Client
- Feel free to fork and improve the project!
- This project is for learning purposes.