Class UDPSocketSend

Inheritance Relationships

Base Type

Class Documentation

class UDPSocketSend : public ska::pst::recv::UDPSocket

Provides implementation of a UDP socket for transmitting UDP packets. Abstracts much of the complexity of dealing with linux socket libraries.

Public Functions

UDPSocketSend()

Construct a new UDPSocketSend object.

virtual ~UDPSocketSend() = default

Destroy the UDPSocketSend object.

void open(const std::string &dest_ipv4_address, int dest_port, const std::string &local_ipv4_addr)

open the socket to send to the IP address, port, binding to the local IP address

open the socket to send to the IP address, port, binding to the local IP address

Parameters
  • dest_ipv4_address – destination IPv4 address for the UDP packets

  • dest_port – destination port for the UDP packets

  • local_ipv4_addr – local interface to use for sending to the destination. If “any” is provided use any available interface

size_t send()

Send the contents of the buf to as a UDP packet.

Returns

size_t number of bytes sent

size_t send(size_t nbytes)

Send the contents of the buf, but limit the packet size.

Parameters

nbytes – number of bytes to send

Returns

size_t number of bytes sent