A collection of socket-based applications showcasing the fundamentals of network communication. This repository contains the following two projects:
- Webserver: A lightweight web server built in C to serve static web pages.
- Chat Application: A real-time chat application implemented in C using sockets for client-server communication.
Note
Both the application has multithreading implemented for multi user access and handle multiple connections.
- Serves static HTML files to clients over HTTP.
- Handles basic HTTP
GETandPOSTrequests. - Multithreaded to handle multiple client requests simultaneously.
- Simple to configure and run.
- Compile the webserver:
gcc webserver.c -o webserver
- Run the server:
./webserver
- Access the server via a browser or a tool like
postman:http://localhost:<port>
Tip
Use -lpthread if you get hit with a warning that pthread is undefined
- Real-time, text-based messaging between multiple clients.
- Server handles concurrent clients using threads.
- Lightweight and efficient implementation using low level C sockets.
-
Compile both server and client:
gcc server.c -o server
gcc client.c -o client
-
Start up the server by just:
./server
-
Start the client with whatever
PORTthat isn't busy:./client <port-numeber>
-
Create multiple clients in different windows to access multiple chat clients.
.
├── webserver/
│ ├── webserver.c
│ ├── index.html
│ └── webserver
├── chatapp/
│ ├── server.c
│ ├── server
│ ├── client.c
│ └── client
└── README.md
-
Clone the repository:
git clone https://github.com/your-username/socket-programming-projects.git cd socket-programming-projects -
Follow the instructions in the Webserver and Chat Application sections to run the projects.
Contributions are welcome! To contribute:
- Fork this repository.
- Create a feature branch:
git checkout -b feature/your-feature-name
- Commit your changes:
git commit -m "Add your feature description" - Push to your branch:
git push origin feature/your-feature-name
- Open a pull request.
Developed by Bhavya Gupta (aka Gamin8ing).