In this chapter, we are going to implement an HTTP web server that can serve static files from a local directory. HTTP is a text-based client-server protocol that uses the Transmission Control Protocol (TCP).
When implementing our HTTP server, we need to support multiple, simultaneous connections from many clients at once. Each received HTTP Request needs to be parsed, and our server needs to reply with the proper HTTP Response. This HTTP Response should include the requested file if possible.
Consider the HTTP transaction illustrated in the following diagram:
In the preceding diagram, the client is requesting /document.htm ...