Public Member Functions | Static Public Attributes | Private Attributes | List of all members
UdpMulticastSocket Class Reference

Allows to retrieve data from a UDP multicast group. More...

#include <socket.h>

Public Member Functions

const char * getBuffer ()
 Returns a pointer to the internal buffer, holding the received data. More...
 
int recv ()
 Retrieve data from multicast group. More...
 
int send (const char *buf, unsigned int sz, int port)
 
 UdpMulticastSocket (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. More...
 
 ~UdpMulticastSocket ()
 

Static Public Attributes

static const int MAXRECV = 3000
 Maximum number of bytse that can be read at a time. More...
 

Private Attributes

char buf [MAXRECV+1]
 
sockaddr_in HostAddr
 
sockaddr_in m_local_addr
 
int m_socket
 
bool remote_ip_exist
 

Detailed Description

Allows to retrieve data from a UDP multicast group.

Definition at line 55 of file socket.h.

Constructor & Destructor Documentation

UdpMulticastSocket::UdpMulticastSocket ( 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.

Definition at line 40 of file socket.cpp.

UdpMulticastSocket::~UdpMulticastSocket ( )

Definition at line 146 of file socket.cpp.

Member Function Documentation

const char* UdpMulticastSocket::getBuffer ( )
inline

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

The buffer size may be obtained from MAXRECV.

Definition at line 77 of file socket.h.

int UdpMulticastSocket::recv ( )

Retrieve data from multicast group.

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

This call is non-blocking.

Definition at line 151 of file socket.cpp.

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

Definition at line 176 of file socket.cpp.

Member Data Documentation

char UdpMulticastSocket::buf[MAXRECV+1]
private

Definition at line 90 of file socket.h.

sockaddr_in UdpMulticastSocket::HostAddr
private

Definition at line 88 of file socket.h.

sockaddr_in UdpMulticastSocket::m_local_addr
private

Definition at line 87 of file socket.h.

int UdpMulticastSocket::m_socket
private

Definition at line 86 of file socket.h.

const int UdpMulticastSocket::MAXRECV = 3000
static

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

Definition at line 60 of file socket.h.

bool UdpMulticastSocket::remote_ip_exist
private

Definition at line 89 of file socket.h.


The documentation for this class was generated from the following files:


mocap_optitrack
Author(s): Kathrin Gräve , Alex Bencz/ , Tony Baltovski , JD Yamokoski
autogenerated on Fri Mar 26 2021 02:05:51