connect(...) timeout?

closed account (Lv0f92yv)
I have an IP address that I connect to using the following:

connect( mySocket, (SOCKADDR*) &myAddress, sizeof( myAddress ) )

This blocks until a connection is established or fails, the latter of which takes several seconds. Is there a way to force a quicker timeout for this function, so it fails and returns quicker than it does by default?

The winsock header: #include "WinSock2.h"

In case it matters, the failure cause I am interested in is if the server is simply not listening. (I.E. network cables are assumed to be fine, network card works, no hardware problems).

Thanks in advance.
Topic archived. No new replies allowed.