0

I have a small portable tool which connects to around 150 servers at diverse locations to get a quick status check from them. It is important to get the status for all servers back to the user relatively quickly so the tool connects to the servers in parallel using non-blocking connect, and uses select() to determine when each socket is ready. The use of select() is fairly straightforward, and the tool is failure mature now and works well on Linux. It runs on windows xp, but connections to the vast majority of the servers out there do not complete. The tool staggers the calls to connect to avoid creating what looks like a SYN flood. It connects to one server about 100 msecs. I also have a check in place to ensure FD_SETSIZE is not violated. I have anecdotal evidence from someone else that the behaviour is better on later windows versions, but have not been able to verify.

I have used WinDump to verify that the syn packets are being sent, and I can see ack packets coming back, but select() keeps returning zero, and the code simply can't connect to most of the servers that do exist, and I can connect to just fine with the same code on Linux.

Has anyone seen and or solved any similar issues with many non-blocking connects and select on Windows XP?

Al Riddoch
  • 583
  • 2
  • 9
  • I've never done anything like this, but can you split the work across multiple processes? – Jack Kelly Mar 27 '11 at 22:44
  • Difficult to give an answer without seeing your select handling. But you should check, that your get all accepted connection for each select return. You probably need to check more than once FD_IS_SET. – harper Mar 28 '11 at 04:46

1 Answers1

0

After another day or so of digging I seem to have found the answer. On windows XP SP2 there is a limit of 10 concurrent connecting sockets system wide. If 10 or more half open connections exist, a System event is logged noting that the limit has been reached, and new connecting sockets are throttled silently. The System Event number is 4226.

I have fixed my code by adding version checks for Windows XP, and throttled to less than 10 connections on those systems. So far I have no reports of other versions being affected.

Al Riddoch
  • 583
  • 2
  • 9