D. J. Bernstein

The timeoutconn library interface

     #include <timeoutconn.h>


     int s;
     char ip[4];
     uint16 p;
     unsigned int t;

timeoutconn attempts to make a connection from TCP socket s to TCP port p on IP address ip.

s must initially be non-blocking. If the connection succeeds, timeoutconn makes s blocking, and returns 0.

If the connection fails, or does not succeed or fail within t seconds, timeoutconn returns -1, setting errno appropriately.