Hi,

Im having problems in a multithreaded client tool with connecting to
multiple hosts at the same time.
The tool is a test tool for our embedded products that communicate over
TCP/IP.
The tool has a 'scan network' feature in which a specific datagram is
broadcast over the network (UDP), and all products answer with another
broadcast in which their IP address and port are stated. Then I start a
thread for each answer, in which I connect to the product (TCP) and get
some more specific info.
I used to do it in 1 thread sequentially, but as soon as some product is
misconfigured and has an IP address outside the subnet, you have to wait
for connect to timeout before you can get to the rest, hence the
multithreading.

What I see happening now is that if there are more than 10 threads that
are waiting for a connect to complete, the 11th and next calls to
connect don't send out SYN packets until one of the outstanding sockets
is connected or time out. It seems as if the IP stack can only handle 10
outstanding connects. My sockets are blocking at the moment of
connection (I set them non-blocking after the connection completes).
This becomes a problem if there are more than 10 misconfigured boards on
the net: if those are the first to answer, the other threads are again
forced to wait until those timeout, rendering my multithreading scheme
useless.

Is this normal behaviour, or is this a limitation of the Windows IP
stack, or just some setting, and if so, can I change is
programmatically? Would it help if I made the socket non-blocking before
connecting (and then use select)?

Thanks!