Reputation: 431
I have one confusion about a design problem: so usually in the server loop if we accept a new client, we spawn a new thread to handle the connection. However, suppose there are like 100 clients connected to the server, obviously we cannot spawn 100 threads to do all of the story. How do you usually deal with this case in Java? I don't want to limit the number of connections to be a small number. Can event-driven socket programming solve this problem?
Upvotes: 0
Views: 117
Reputation: 311055
obviously we cannot spawn 100 threads
Certainly you can spawn 100 threads. You can spawn thousands. Tens of thousands. Maybe more. A hundred is nothing.
Upvotes: 1