This is a simple command-line chat application that uses socket programming to establish a connection between the client and the server. The application is developed in C and supports both Windows and Linux operating systems.
-
C compiler (GCC recommended)
-
Windows or Linux operating system
-
Clone the repository
git clone https://github.com/UtkarshAhuja2003/chat-app.git
-
Navigate to the project directory
cd chat-app
-
Compile the server and client source code by running
- Linux
gcc -o server server.c
andgcc -o client client.c
- Windows
gcc -o server server.c -lws2_32
andgcc -o client client.c -lws2_32
-
Start the server by running
./server
-
Start the client by running
./client
- Chat will continue until both the users write BYE
This chat application uses socket programming to establish a connection between the client and the server. Sockets are the endpoint of a bidirectional communication channel between two programs running on a network. A socket has a "type" (e.g., SOCK_STREAM for TCP or SOCK_DGRAM for UDP), an IP address, and a port number.
In this project, the server creates a socket and binds it to a specific port. The client then connects to the server using the IP address and port number of the server's socket. Once the connection is established, the client and server can send and receive data using the socket.
-
Beej's Guide to Network Programming - A helpful guide to socket programming in C
-
Linux Socket Programming by Example - A code example of a TCP server in C
-
Windows Socket Programming - A guide to socket programming in C on Windows
We welcome contributions to this project. If you would like to contribute, please fork the repository, make your changes and submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.