Simultaneous Connections
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 connecti开发者_开发技巧on?
Thanks
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.
精彩评论