libdill: Structured Concurrency for C

NAME

udp_send - sends a UDP packet

SYNOPSIS

#include <libdill.h>

int udp_send(int s, const struct ipaddr *addr, const void *buf, size_t len);

int udp_sendl(int s, const struct ipaddr *addr, struct iolist *first, struct iolist *last);

DESCRIPTION

UDP is an unreliable message-based protocol. The size of the message is limited. The protocol has no initial or terminal handshake. A single socket can be used to different destinations.

This function sends a packet to address addr. addr can be set to NULL in which case remote address specified in udp_open() function will be used.

Given that UDP protocol is unreliable the function has no deadline. If packet cannot be sent it will be silently dropped.

RETURN VALUE

The function returns 0 on success. On error, it returns -1 and sets errno to one of the values below.

ERRORS

EXAMPLE

rc = udp_send(s, NULL, "ABC", 3);