Skip to content

SolusDev-sys/ChatTCP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TCP Server / Client

A simple multithreaded TCP server and client written in C. The server listens on port 9999 and handles each client connection in a separate pthread.

Server

Run the server first. It will accept incoming client connections, each handled in its own thread. To shut down the server, press Ctrl+C. It will stop accepting new connections and close the server socket.

Client

Run the client to connect to the server and exchange messages. Type any message and press Enter to send it. The server will echo it back. As a special case, sending hello will receive world in response. To disconnect, type disconnect and press Enter. The server will reply with a goodbye message and close the connection.

Build

mkdir build && cd build
cmake ..
make

Run the server:

./server

Run the client in a separate terminal:

./client

License

This project is released under the MIT License.

About

Chat server made with C and Linux Socket API

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors