A simple multithreaded HTTP server built in C using POSIX sockets and pthreads.
- Socket Programming: Implements TCP/IP communication using Berkeley sockets (POSIX).
- Multithreading: Implements concurrent request handling using the pthreads library.
- Thread Pool: Uses a custom thread pool with a concurrent queue for efficient thread management.
- HTTP Support: Handles GET requests with proper HTTP response headers.
- Static File Serving: Serves static HTML and JPEG content.
The server listens on port 8000 and serves:
/- HTML page/image- JPEG image- Other routes return 404
- C compiler
- pthread library
make./serverThe server will start listening on port 8000 on all interfaces.
You should probably not run this on a public WiFi network...
Use any of the following methods to test:
Using a web browser:
http://localhost:8000/
Using the included Python client:
python3 client.py /
python3 client.py /imageUsing curl:
curl http://localhost:8000/Load testing with Apache Bench:
ab -n 1000 -c 50 http://localhost:8000/