Frameworks
As you can see, writing servers using these lower level threading and poll
APIs can be quite involved, especially considering that various things which would be expected in a production system, such as logging and comprehensive error handling, haven't been included in our examples due to brevity.
Many people have hit these problems before us, and several libraries and frameworks are available for taking some of the leg work out of writing the network servers.