UCL Common Library Reference | |||
---|---|---|---|
<<< Previous Page | Home | Up | Next Page >>> |
#include <net_udp.h> struct socket_udp; int udp_addr_valid (const char *addr); socket_udp* udp_init (const char *addr, |
These functions provide a unified interface for sending are receiving UDP datagrams over IPv4 and IPv6 networks.
For IPv6 addresses to work the common library must be built with IPv6 enabled. On UNIX, the configure script has an option --enable-ip-v6 for this purpose. On Win32, there is a project configuration to use the Microsoft IPv6 stack when installed.
struct socket_udp; |
An opaque data structure containing information for a UDP session.
socket_udp* udp_init (const char *addr, |
Creates a session for sending and receiving UDP datagrams over IP networks.
socket_udp* udp_init_if (const char *addr, const char *iface, |
Creates a session for sending and receiving UDP datagrams over IP networks. The session uses iface as the interface to send and receive datagrams on.
int udp_send (socket_udp *s, char *buffer, int buflen); |
Transmits a UDP datagram containing data from buffer.
int udp_recv (socket_udp *s, char *buffer, int buflen); |
Reads from datagram queue associated with UDP session.
void udp_fd_zero (void); |
Clears file descriptor from set associated with UDP sessions (see select(2)).
void udp_fd_set (socket_udp *s); |
Adds file descriptor associated of s to set associated with UDP sessions.
int udp_fd_isset (socket_udp *s); |
Checks if file descriptor associated with UDP session is ready for reading. This function should be called after udp_select().
int udp_fd (socket_udp *s); |
This function allows applications to apply their own