A server-side working with a network often looks like a sequence where we first get the new connection, read data, then process it, and then send the result. Imagine that we are creating some kind of authorization server that must process huge amount of requests per second. In that case, we need to accept, receive, send asynchronously, and process tasks in multiple threads.
In this recipe, we'll see how to extend our tasks_processor class to accept and process incoming connections, and, in the next recipe, we'll see how to make it multithreaded.