Class nebula::drivers::connections::UdpSocket::Builder
ClassList > nebula > drivers > connections > UdpSocket > Builder
#include <udp.hpp>
Public Functions
Type | Name |
---|---|
Builder (const std::string & host_ip, uint16_t host_port) Build a UDP socket with timestamp measuring enabled. The minimal way to start receiving on the socket is UdpSocket::Builder(...). bind() .subscribe(...); . |
|
UdpSocket | bind () Bind the socket to host IP and port given in init() . Ifjoin_multicast_group() was called before this function, the socket will be bound togroup_ip instead. At leastinit() has to have been called before. |
Builder && | join_multicast_group (const std::string & group_ip) Join an IP multicast group. Only one group can be joined by the socket. |
Builder && | limit_to_sender (const std::string & sender_ip, uint16_t sender_port) Set the socket to drop all packets not coming from sender_ip andsender_port . |
Builder && | set_mtu (size_t bytes) Set the MTU this socket supports. While this can be set arbitrarily, it is best set to the MTU of the network interface, or to the maximum expected packet length. |
Builder && | set_polling_interval (int32_t interval_ms) Set the interval at which the socket polls for new data. THis should be longer than the expected interval of packets arriving in order to not poll unnecessarily often, and should be shorter than the acceptable time delay for unsubscribe() . Theunsubscribe() function blocks up to one full poll interval before returning. |
Builder && | set_socket_buffer_size (size_t bytes) Set the internal socket receive buffer size. See SO_RCVBUF inman 7 socket for more information. |
Public Functions Documentation
function Builder
Build a UDP socket with timestamp measuring enabled. The minimal way to start receiving on the socket is UdpSocket::Builder(...). bind() .subscribe(...);
.
inline nebula::drivers::connections::UdpSocket::Builder::Builder (
const std::string & host_ip,
uint16_t host_port
)
Parameters:
host_ip
The address to bind to.host_port
The port to bind to.
function bind
Bind the socket to host IP and port given in init()
. Ifjoin_multicast_group()
was called before this function, the socket will be bound togroup_ip
instead. At leastinit()
has to have been called before.
inline UdpSocket nebula::drivers::connections::UdpSocket::Builder::bind ()
function join_multicast_group
Join an IP multicast group. Only one group can be joined by the socket.
inline Builder && nebula::drivers::connections::UdpSocket::Builder::join_multicast_group (
const std::string & group_ip
)
Parameters:
group_ip
The multicast IP. It has to be in the multicast range224.0.0.0/4
(between224.0.0.0
and239.255.255.255
).
function limit_to_sender
Set the socket to drop all packets not coming from sender_ip
andsender_port
.
inline Builder && nebula::drivers::connections::UdpSocket::Builder::limit_to_sender (
const std::string & sender_ip,
uint16_t sender_port
)
Parameters:
sender_ip
The only allowed sender IP. Cannot be a multicast or broadcast address.sender_port
The only allowed sender port.
function set_mtu
Set the MTU this socket supports. While this can be set arbitrarily, it is best set to the MTU of the network interface, or to the maximum expected packet length.
inline Builder && nebula::drivers::connections::UdpSocket::Builder::set_mtu (
size_t bytes
)
Parameters:
bytes
The MTU size. The default value is 1500.
function set_polling_interval
Set the interval at which the socket polls for new data. THis should be longer than the expected interval of packets arriving in order to not poll unnecessarily often, and should be shorter than the acceptable time delay for unsubscribe()
. Theunsubscribe()
function blocks up to one full poll interval before returning.
inline Builder && nebula::drivers::connections::UdpSocket::Builder::set_polling_interval (
int32_t interval_ms
)
Parameters:
interval_ms
The desired polling interval. Seeman poll
for the meanings of 0 and negative values.
function set_socket_buffer_size
Set the internal socket receive buffer size. See SO_RCVBUF
inman 7 socket
for more information.
inline Builder && nebula::drivers::connections::UdpSocket::Builder::set_socket_buffer_size (
size_t bytes
)
Parameters:
bytes
The desired buffer size in bytes.
The documentation for this class was generated from the following file nebula_hw_interfaces/include/nebula_hw_interfaces/nebula_hw_interfaces_common/connections/udp.hpp