The problem is not in the connection itself, but in the call that resolves the address to the host. Those calls are gethostbyaddr and gethostbyname. They are
encapsulated in the CAsyncSocket class. CSocket derives from CAsyncSocket.
Check MSDN for documentation on asynchronous call to databases and on
WSAAsyncGetHostByName.
and Take a look at Microsoft KB, Q138692 - How to Configure a Time-Out on a
CSocket Operation.
http://support.microsoft.com/support/kb/articles/Q138/6/92.asp