June 2017
Beginner to intermediate
274 pages
6h 49m
English
The server can handle simultaneous connections from many clients at once because the start_server coroutine we called launches a new task to run the start_serve coroutine each time a client connects to the server.
Each task has the job of handling a connection to a single client, so the server coroutine is almost as simple as the client coroutine.
There's a little bit of extra code to handle a connection reset error, which is the exception that gets raised if the client suddenly disconnects while the server's trying to read data from it, and a little more to handle the class where the request is an empty string, which the readline coroutine can only produce if the client has closed the connection in a less ...
Read now
Unlock full access