Reputation: 8364
I have one thread to treat each new tcp/ip connection. What happens if two simultaneous requests re made to the same port? One will be rejected? Is there a solution to this problem or I have to retry the connection?
Thanks
Upvotes: 0
Views: 219
Reputation: 655
The problem you think exists doesn't exist. You could even handle multiple clients in a single thread if you really wanted to. Bind, Listen, loop and accept new connections. The kernel handles the actual tcp/ip stack, so after you bind and start listening you're basically telling the kernel to handle new connections coming in on the port you specify. Just because you aren't blocking on 'Accept' the moment a connection is made doesn't mean you won't be able to handle that connection attempt.
Like I said, give it a shot - run a few tests to see for yourself.
Upvotes: 2