Question about listening and backlog for sockets

I am writing an application in C# that needs to handle incoming connections and I've never done server side programming before. This leads me to these following questions:

  • Pros and cons of high backlog / low backlog? Why shouldn't we set the backlog to a huge number?
  • If I call Socket.Listen(10), after 10 Accept()s do I have to call Listen() again? Or do I have to call Listen() after every Accept()?
  • If I set my backlog to 0 and hypothetically two people want to connect to my server at the same time, what would happen? (I am calling Socket.Select in a loop and checking readability of the listening socket, after I handle the first connection would the second connection be successful upon the next iteration if I called Listen() again?)

Thanks in advance.

7
задан Marlon 23 November 2010 в 06:49
поделиться