diff options
Diffstat (limited to 'man/socket_udp.3')
-rw-r--r-- | man/socket_udp.3 | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/man/socket_udp.3 b/man/socket_udp.3 new file mode 100644 index 0000000..eff0290 --- /dev/null +++ b/man/socket_udp.3 @@ -0,0 +1,58 @@ +.TH qlibs: socket_udp 3 +.SH NAME +socket_udp \- setting up UDP datagram sockets +.SH SYNTAX +.B #include \(dqsocket_if.h\(dq + +int \fBsocket_udp4\fP(); +.br +int \fBsocket_udp6\fP(); +.br +int \fBsocket_udp\fP(); +.SH DESCRIPTION +.B socket_udp4 +creates a non-blocking UDP/IPv4 datagram socket and +providing a file descriptor pointing to that socket. + +.B socket_udp6 +creates a non-blocking UDP/IPv6 datagram socket and +providing a file descriptor pointing to that socket. + +.B socket_udp +creates a non-blocking IPv6 UDP socket calling +.B socket_udp6 +unless it can't bind to IPv6 and now facilitating +.BR socket_tcp4 . + +.SH "REMOTE CODES" +All these routines return +.IR 0 +except in case of failures, returning +.I -1 +and setting +.I errno +appropriately, without allocating any resources. +.SH EXAMPLE + #include <socket_if.h> + int \fIu\fR; + char \fIlocalip\fR[16]; + char \fIremoteip\fR[16]; + uint16 \fIp\fR; // port + + if (ip6_isv4mapped(remoteip)) { + u = socket_udp4(); + socket_bind4(u,localip + 12,p); + } else + u = socket_udp6(); + socket_bind6(u,localip,p,0); + } + socket_connect(u,remoteip,p,0); +.SH "SEE ALSO" +socket_if(3), +socket_bind(3), +socket_connect(3), +socket_info(3), +socket_recv(3), +socket_send(3), +socket_setup(3), +socket_tcp(3) |