Thunderbots Project
Loading...
Searching...
No Matches
ThreadedUdpSender Class Reference
Inheritance diagram for ThreadedUdpSender:

Public Member Functions

 ThreadedUdpSender (const std::string &ip_address, unsigned short port, const std::string &interface, bool multicast)
 
 ~ThreadedUdpSender ()
 
std::string getInterface () const
 
std::string getIpAddress () const
 
void sendString (const std::string &message, bool async=false)
 

Constructor & Destructor Documentation

◆ ThreadedUdpSender()

ThreadedUdpSender ( const std::string &  ip_address,
unsigned short  port,
const std::string &  interface,
bool  multicast 
)

Creates a UdpSender that sends the sendString over the network on the given address and port.

Exceptions
TbotsNetworkExceptionif the multicast group could not be joined if the multicast option is requested
Parameters
ip_addressThe ip address to send data on (IPv4 in dotted decimal or IPv6 in hex string) example IPv4: 192.168.0.2 example IPv6: ff02::c3d0:42d2:bb8wlp4s0 (the interface is specified after %)
portThe port to send sendString data on
interfaceThe interface to send data on
multicastIf true, joins the multicast group of given ip_address

◆ ~ThreadedUdpSender()

Destructor will stop the io_service thread

Member Function Documentation

◆ getInterface()

std::string getInterface ( ) const

Get the interface that this sender is sending on.

Returns
The interface as a string

◆ getIpAddress()

std::string getIpAddress ( ) const

Get the IP address that this sender is sending to.

Returns
The IP address as a string

◆ sendString()

void sendString ( const std::string &  message,
bool  async = false 
)

Sends a string message to the initialized ip address and port This function returns after the message has been sent.

Parameters
messageThe string message to send
asyncIf true, the message will be sent asynchronously otherwise it will be send synchronously

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