Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Readme.md

TCP Web Server in C

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.


Features

  • Listens for incoming TCP connections on port 8080.
  • Serves a static HTML file (index.html) to clients.
  • Simple and easy-to-understand codebase.

Getting Started

Prerequisites

  • GCC compiler
  • Basic knowledge of C programming

Installation

  1. Clone the repository:
    https://github.com/dexter-xD/tcp_server_c.git
    cd tcp_server_c
    git checkout mini-tcp-server
  2. Compile the code:
    make
  3. Run the server:
    make run

Usage

  • Open your browser and navigate to http://localhost:8080.
  • You should see the content of index.html displayed.

Project Structure

tcp-server/
├── index.html       # HTML file to serve
├── webserver.c      # C source code
└── Makefile         # For easy compilation

Learn More

For a detailed step-by-step tutorial, check out the blog post:
Building a Simple TCP Web Server in C


Support

If you found this project helpful, consider supporting me: