I have started writing the server in Java, based on sockets and I have some questions. When I have the incoming request then ServerSocket returns Socket to me. Then I create the separate thread and use this new socket there. After some incoming requests, I have some separated threads and some sockets. All sockets use the same input address and port. Question -
How server understand to which thread he has to give input packet? Can you please give some advice about books or links that I can read to understand how the server works on low level?
How server (for example Apache tomcat) processing incoming sockets? As I understand, server has one input queue for input packet. Is this queue affects on the server's speed? Where can I read about such low level algorithm of server working?