Next: , Previous: , Up: Client connections   [Contents][Index]


5.2.7.3 UDP sockets

The UDP sockets implement a connectionless, unreliable datagram packet service. Packets may be reordered or duplicated before they arrive. UDP generates and checks checksums to catch transmission errors.

Function: svz_socket_t * svz_udp_connect (svz_address_t *host, in_port_t port)

Create a UDP connection to host at port and set the socket descriptor in structure sock to the resulting socket. Return a NULL value on errors.

This function can be used for port bouncing. If you assign the handle_request callback to something server specific and the cfg field of the server’s configuration to the returned socket structure, this socket is able to handle a dedicated UDP connection to some other UDP server.

Function: int svz_udp_write (svz_socket_t *sock, char *buf, int length)

Write buf into the send queue of the UDP socket sock. If length argument supersedes the maximum length for UDP messages it is split into smaller packets.