Please take a look at the segment of code below:
SOCKET sock = socket( AF_INET, SOCK_STREAM, 0 );
if ( sock == INVALID_SOCKET )
{
SetErrorCode(WSAGetLastError());
return FALSE;
}
int nRet = connect( sock, (PSOCKADDR)&remoteAddr, sizeof(remoteAddr));
if (nRet == SOCKET_ERROR )
{
SetErrorCode(WSAGetLastError());
return FALSE;
}
The problem is that when I specify non-existed IP address (but within valid range of IP addresses for our network) "connect" function doesn't return for 40 seconds or so. Can anyone advice how to configure timeout for "connect" function? Or how can I make this waiting time shorter? Thanks
SOCKET sock = socket( AF_INET, SOCK_STREAM, 0 );
if ( sock == INVALID_SOCKET )
{
SetErrorCode(WSAGetLastError());
return FALSE;
}
int nRet = connect( sock, (PSOCKADDR)&remoteAddr, sizeof(remoteAddr));
if (nRet == SOCKET_ERROR )
{
SetErrorCode(WSAGetLastError());
return FALSE;
}
The problem is that when I specify non-existed IP address (but within valid range of IP addresses for our network) "connect" function doesn't return for 40 seconds or so. Can anyone advice how to configure timeout for "connect" function? Or how can I make this waiting time shorter? Thanks