A minimal TCP web server written in C that serves an HTML file. This project is designed to help beginners understand the basics of socket programming, HTTP, and server architecture.
- Listens for incoming TCP connections on port 8080.
- Serves a static HTML file (
index.html) to clients. - Simple and easy-to-understand codebase.
- GCC compiler
- Basic knowledge of C programming
- Clone the repository:
https://github.com/dexter-xD/tcp_server_c.git cd tcp_server_c git checkout mini-tcp-server - Compile the code:
make
- Run the server:
make run
- Open your browser and navigate to
http://localhost:8080. - You should see the content of
index.htmldisplayed.
tcp-server/
├── index.html # HTML file to serve
├── webserver.c # C source code
└── Makefile # For easy compilation
For a detailed step-by-step tutorial, check out the blog post:
Building a Simple TCP Web Server in C
If you found this project helpful, consider supporting me: