in reply to To Fork for Not to Fork

The code as written is using forking to separate reading and writing so they don't block. It is not using forking to serve multiple clients at once. Also, the server is reading from stdin; it is doing the equivalent of netcat and piping through the network connection.

In a forking server, the child process handles the request, and the parent process goes back to waiting for new clients. If you want to separate reading and writing, the child process can fork again, with the grandchild handling reading and the child writing.