Thunderbots Project
Loading...
Searching...
No Matches
UdpSender Class Reference

Public Member Functions

 UdpSender (boost::asio::io_service &io_service, const std::string &ip_address, unsigned short port, const std::string &interface, bool multicast)
 
 ~UdpSender ()
 
std::string getInterface () const
 
std::string getIpAddress () const
 
void sendString (const std::string &message)
 
void sendStringAsync (const std::string &message)
 

Constructor & Destructor Documentation

◆ UdpSender()

UdpSender ( boost::asio::io_service &  io_service,
const std::string &  ip_address,
unsigned short  port,
const std::string &  interface,
bool  multicast 
)

Creates a UdpSender that sends strings over the network to the given address and port.

Exceptions
TbotsNetworkExceptionif the listener could not be created
Parameters
io_serviceThe io_service to use to service outgoing SendString data
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:bb8
portThe port to send SendString data to
interfaceThe interface to send data on
multicastIf true, joins the multicast group of given ip_address

◆ ~UdpSender()

~UdpSender ( )

Destructor

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)

Get the port that this sender is sending to

Returns
The port as an unsigned short 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

◆ sendStringAsync()

void sendStringAsync ( const std::string &  message)

Sends a string message to the initialized ip address and port asynchronously This function returns immediately.

Parameters
messageThe string message to send

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