Synopsis
void ctl_udp_sendto(void *data,
size_t byte_count,
const CTL_UDP_INFO_t *info,
unsigned flags);
Description
ctl_udp_sendto sends a UDP datagram to a remote host. The member
other_port of info is the remote port and the member otherIpAddr of info
is the remote IP address.
ctl_udp_sendto will return almost immediately, after the outgoing datagram has been
queued for transmission by the MAC layer or queued for ARP hold at the IP layer.
The UDP datagram will be dropped by the network library if:
- The destination IP address is not on the local subnet (as returned
by ctl_net_is_local_ip_address) and no gateway is configured, or
- The network library cannot allocate an Ethernet transmission frame for
the datagram, or
- The network library cannot allocate network memory for the datagram
payload.
flags may be zero or one of the following:
-
CTL_UDP_SENDTO_NOCOPY
- Perform a zero-copy send of static data. This flag indicates
that data meets the target CPU's requirement for network DMA
memory (if any) and that data will remain in scope indefinitely.
Buffer pointer data will be passed through the stack directly to
the MAC layer instead of copying its data to network memory first.
-
CTL_UDP_SENDTO_FREE
- Perform a zero-copy send of dynamic data. This flag indicates
that data was allocated by application code using
ctl_net_mem_alloc_data and that the library is to use
ctl_net_mem_free to free it after it is sent.
See Also
CTL_UDP_INFO_t, ctl_udp_init, ctl_udp_bind,
ctl_net_mem_alloc_data, ctl_net_mem_free