Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Web Server

A lightweight C++ web server built to explore low-level networking, HTTP request handling, multithreading, and concurrent client connections.

This project uses POSIX sockets directly instead of a web framework, making the request/response flow easy to inspect and extend.

Features

  • TCP socket setup with socket, bind, listen, and accept
  • Basic HTTP/1.1 responses with status line, headers, and body
  • One detached worker thread per client connection
  • Simple health-check route for smoke testing
  • Small Makefile-based build with no external dependencies

Requirements

  • Linux or another POSIX-like environment with socket APIs
  • g++ with C++17 support
  • make

Build

make

This creates a server executable in the project root.

Run

./server

By default, the server listens on:

http://0.0.0.0:8080

From the same machine, use 127.0.0.1 in your browser or curl:

curl http://127.0.0.1:8080/

Routes

Method Path Response
GET / Small HTML page
GET /health OK
GET anything else 404 Not Found

Project Structure

.
|-- Makefile
|-- README.md
|-- http_tcpServer.cpp
|-- http_tcpServer.h
`-- server.cpp
  • server.cpp creates the server and starts the listen loop.
  • http_tcpServer.h declares the http::TcpServer API.
  • http_tcpServer.cpp contains the socket setup, client handling, and HTTP response generation.

Clean Build Artifacts

make clean

Notes

This is an educational server, not a production HTTP implementation. It intentionally keeps parsing, routing, and thread management simple so the networking mechanics stay visible.

About

A lightweight C++ web server built to explore low-level networking, HTTP request handling, multithreading, and efficient concurrent client connections.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages