.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 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)