an HTTP server in c++
At the most basic level, whenever a browser needs a file that is hosted on a web server, the browser requests the file via HTTP. When the request reaches the correct (hardware) web server, the (software) HTTP server accepts the request, finds the requested document, and sends it back to the browser, also through HTTP.
HTTP server usually use TCP for communications.
Socket : mechanism to give programs access to the network
- create a socket with
socket()
- identify the socket with
bind()
- wait for a connection with
listen()
andaccept()
- send and receive messages with
read()
andwrite()
(orsend()
andrecv()
) - close the socket with
close()
How to build a simple HTTP server
Understanding Nginx Server and Location Block Selection Algorithms