Hand the connection off and go straight back to accept()
Hand the connection off and go straight back to accept()
Answer
while (true) { // no try-with-resources here: the socket outlives this block Socket client = listener.accept(); new Thread(new DaytimeHandler(client)).start(); }
The accepting thread does two things and nothing else: take the connection off the kernel queue, and give it to somebody. It is back inside `accept()` within microseconds, so the queue drains at handshake speed rather than at handler speed.
Harold 4e ch9 §Multithreaded Servers