1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
.TH qlibs: timeoutconn 3
.SH NAME
timeoutconn \- set up an outoing stream socket for IPv4/IPv6
.SH SYNTAX
.B #include \(dqtimeoutconn.h\(dq
int \fBtimeoutconn4\fP(int \fIs\fR,char \fIip[4]\fR,uint16 \fIp\fR,unsigned int \fIt\fR);
.br
int \fBtimeoutconn6\fP(int \fIs\fR,char \fIip[16]\fR,uint16 \fIp\fR,unsigned int \fIt\fR,uint32 \fInetif\fR);
.br
int \fBtimeoutconn\fP(int \fIs\fR,char \fIip[16]\fR,uint16 \fIp\fR,unsigned int \fIt\fR,uint32 \fInetif\fR);
.SH DESCRITPION
.B timeoutconn
tries to establish a TCP stream socket to address
.I ip
on remoteport
.I p
and waiting for
.I t
seconds and on success returns the
.I s
socket identifier.
In case
.I addresss
is an IPv6 LLU address, one needs to define the
.I netif
interface index, otherwise
.I 0
is the default.
.SH INTERNALS
.B timeoutconn
depends on
.B taia
and
.B iopuase
to determine the timespan and perhaps
.B ndelay
to succeed.
.SH RETURN CODES
.B timeoutconn
returns
.I 0
if the connection is established
and
.I -1
if an error has occured.
.SH SEE ALSO
socket_if(3),
timeout(3)
taia(3),
wait(3)
|