> The problem is now that I like to cancel the connect if it takes 
> too long.

Essentially, you have no control over how long connect takes to time out.
There are registry settings relating to TCP attempts and retry delays,
but messing with them is dangerous and unpredictable, and effects all
Windows applications.  The default timeout is usually about 40 seconds,
if I remember correctly. 

I always ping servers first before connecting to them, that way you can
set a timeout of a few seconds before trying the next one in the list.
Ping will not fail if the server is running, but nothing is listening on
the port, but then you should get a much shorter timeout.  

My threaded ping works asynchronously very nicely, you put the actual
connection attempt or ping next server code in the event that's called on
successful ping or timeout. MagIpLog on the same page illustrates ping
before connection, and reconnection on lost connection. 



To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to