Thunderbots Project
Loading...
Searching...
No Matches
ThreadedProtoUdpSender< SendProto > Class Template Reference
Inheritance diagram for ThreadedProtoUdpSender< SendProto >:
Collaboration diagram for ThreadedProtoUdpSender< SendProto >:

Public Member Functions

 ThreadedProtoUdpSender (const std::string &ip_address, unsigned short port, const std::string &interface, bool multicast)
 
std::string getInterface () const
 
std::string getIpAddress () const
 
void sendProto (const SendProto &message, bool async=false)
 

Constructor & Destructor Documentation

◆ ThreadedProtoUdpSender()

template<class SendProto >
ThreadedProtoUdpSender ( const std::string &  ip_address,
unsigned short  port,
const std::string &  interface,
bool  multicast 
)

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

Exceptions
TbotsNetworkExceptionif we detect an issue with setting up this sender
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:bb8
portThe port to send SendProto data on
interfaceThe interface to send data on
multicastIf true, joins the multicast group of given ip_address
errorAn optional user-provided string that will be set to an error message if an error occurs

Member Function Documentation

◆ getInterface()

template<class SendProto >
std::string getInterface ( ) const

Get the interface that this sender is sending on.

Returns
The interface as a string

◆ getIpAddress()

template<class SendProto >
std::string getIpAddress ( ) const

Get the IP address that this sender is sending to.

Returns
The IP address as a string

◆ sendProto()

template<class SendProto >
void sendProto ( const SendProto &  message,
bool  async = false 
)

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

Parameters
messageThe protobuf 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 file: