Skip to content

About

An HTTP server built from scratch in C++ using raw sockets

Resources

Stars

16 stars

Watchers

0 watching

Forks

Latest commit

 

History

8 Commits

Folders and files

Repository files navigation

HTTP Server

diagram

An HTTP server built from scratch in C++ using raw sockets, without any frameworks.

Requirements

  • C++17 compatible compiler (gcc, clang, or msvc)
  • CMake 3.10 or higher

Build

cmake -S . -B build
cmake --build build -j

Run

./build/http-server

The server listens on 0.0.0.0:8080.

Test

Once running, open a browser or use curl:

curl http://localhost:8080

How it's working?

The server creates a TCP socket, binds it to an address and port, starts listening for connections, accepts clients, reads the incoming bytes, and sends back a manually constructed HTTP response.

Project Structure

.
├── CMakeLists.txt
├── server.cpp              # Entry point
├── http_tcpServer.h        # TcpServer class declaration
├── http_tcpServer.cpp      # TcpServer implementation

Architecture diagram of harisahmed05/http-server

About

An HTTP server built from scratch in C++ using raw sockets

Resources

Stars

16 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages