The thread-per-connection model handles blocking socket servers by assigning one thread to each connected client. The main thread accepts connections while each client thread repeatedly receives and sends data. section 7.1
A typical implementation follows this sequence:
- Read from and write to the client inside that thread, allowing other clients to proceed independently. section 7.1
This approach lets blocking recv and sendall operations affect only their own client thread, but interruption and shutdown require explicit handling. A thread subclass can detect closed connections, catch socket errors, and send a shutdown message. section 7.1
