qlibs:
Section: Misc. Reference Manual Pages (socket_udp)
Updated: 3
Index
Return to Main Contents
NAME
socket_udp - setting up UDP datagram sockets
SYNTAX
#include "socket_if.h"
int socket_udp4();
int socket_udp6();
int socket_udp();
DESCRIPTION
socket_udp4
creates a non-blocking UDP/IPv4 datagram socket and
providing a file descriptor pointing to that socket.
socket_udp6
creates a non-blocking UDP/IPv6 datagram socket and
providing a file descriptor pointing to that socket.
socket_udp
creates a non-blocking IPv6 UDP socket calling
socket_udp6
unless it can't bind to IPv6 and now facilitating
socket_tcp4.
REMOTE CODES
All these routines return
0
except in case of failures, returning
-1
and setting
errno
appropriately, without allocating any resources.
EXAMPLE
#include <socket_if.h>
int u;
char localip[16];
char remoteip[16];
uint16 p; // 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);
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)
Index
- NAME
-
- SYNTAX
-
- DESCRIPTION
-
- REMOTE CODES
-
- EXAMPLE
-
- SEE ALSO
-
This document was created by
man2html,
using the manual pages.
Time: 14:55:39 GMT, December 15, 2024