Close a remote connection which has not yet timed out.
int Ns_SockCloseLater ( SOCKET sock );
Ns_SockCloseLater can be used to have the socket service thread close a socket which has yet to timeout after an Ns_SockAsyncConnect.
SOCKET sock; fd_set set; struct timeval tv; sock = Ns_SockAsyncConnect("mailhost", 25); ... perform some other work while connection is in progress... ... check for connection ... tv.tv_sec = 2; /* allow 2 more seconds */ tv.tv_usec = 0; FD_ZERO(&set); FD_SET(sock, &set); if (select(sock+1, NULL, &set, NULL, &tv) != 1) { ... timeout - close socket and return error... Ns_CloseLater(sock); } else { ... use socket ... }