Networking in C · advanced · ~15 min
Reply to a single HTTP request with a hard-coded response.
Bind to loopback, accept one connection, read the request, write a fixed HTTP/1.0 200 OK\r\nContent-Length: 5\r\n\r\nhello, close. Multi-client support requires fork per connection or select/poll multiplexing.
Even an HTTP/1.0 toy server faces real problems: framing, partial reads, slow clients. That's why real servers are non-trivial.
Content-Length header — clients can't tell where the body ends.