SOCKET Ns_SockTimedConnect ( char *host, int port, int timeout );
Ns_SockTimedConnect creates a socket connected to a remote host and port, ensuring that the connection is established within the number of seconds specified by the timeout
argument.
sock = Ns_SockTimedConnect("mailhost", 25); if (sock == INVALID_SOCKET) { ... timeout or error connecting ... } else { ... use socket ... }