Class UdpMulticastSocket

Class Documentation

class UdpMulticastSocket

Allows to retrieve data from a UDP multicast group.

Public Functions

UdpMulticastSocket(rclcpp::Node::SharedPtr &node, const int local_port, const std::string multicast_ip = "224.0.0.1")

Creates a socket and joins the multicast group with the given address.

~UdpMulticastSocket()
int recv()

Retrieve data from multicast group.

This call is non-blocking.

Returns:

The number of bytes received or -1 if no data is available

inline const char *getBuffer()

Returns a pointer to the internal buffer, holding the received data.

The buffer size may be obtained from MAXRECV.

int send(const char *buf, unsigned int sz, int port)

Public Static Attributes

static const int MAXRECV = 3000

Maximum number of bytse that can be read at a time.