Skip to content

A simple Chatroom built in C programming language. The program is built uses multithreading for handling multiple clients.

License

Notifications You must be signed in to change notification settings

rv0fficial/Chatroom-in-C

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chatroom-in-C

A simple Chatroom built in C programming language. The program has two files - server.c and client.c. The program is built uses multithreading for handling multiple clients.

Run Locally

Compile the Server:

Open a terminal and navigate to the directory containing the server file (server.c). Run the following command:

gcc -pthread -o srv server.c

This command compiles the server code and generates an executable named srv.

Run the Server:

Execute the compiled server program by running:

./srv

This command starts the server, and it will begin listening for incoming connections on the default IP address "127.0.0.1" and port 66666.

Compile the Client:

Open another terminal and navigate to the directory containing the client file (client.c). Run the following command:

gcc -pthread -o cli client.c

This command compiles the client code and generates an executable named cli.

Run the Client:

Execute the compiled client program by running:

./cli 66666

This command starts the client and connects it to the server running on IP address "127.0.0.1" and port 66666. Adjust the port number if you want to use a different one.

Repeat for Additional Clients:

Open new terminals and run additional instances of the client to simulate multiple clients connecting to the server.

./cli 66666

Note: Make sure to run the server first before starting any clients. Also, ensure that the IP address and port specified in the client code match the server's IP address and port.

About

A simple Chatroom built in C programming language. The program is built uses multithreading for handling multiple clients.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 97.7%
  • Makefile 2.3%