timeoutconn − set up an outoing stream socket for IPv4/IPv6
#include "timeoutconn.h"
int
timeoutconn4(int s,char ip[4],uint16
p,unsigned int t);
int timeoutconn6(int s,char
ip[16],uint16 p,unsigned int t,uint32
netif);
int timeoutconn(int s,char
ip[16],uint16 p,unsigned int t,uint32
netif);
timeoutconn tries to establish a TCP stream socket to address ip on remoteport p and waiting for t seconds and on success returns the s socket identifier.
In case addresss is an IPv6 LLU address, one needs to define the netif interface index, otherwise 0 is the default.
timeoutconn depends on taia and iopuase to determine the timespan and perhaps ndelay to succeed.
timeoutconn returns 0 if the connection is established and -1 if an error has occured.
socket_if(3), timeout(3) taia(3), wait(3)