Agora  1.2.0
Agora project
UDPClient Class Reference

#include <udp_client.h>

Collaboration diagram for UDPClient:

Public Member Functions

 UDPClient (const std::string &src_addr, uint16_t src_port, size_t tx_buffer_size=0)
 
 UDPClient (uint16_t src_port)
 
 UDPClient (const std::string &src_addr)
 
UDPClientoperator= (const UDPClient &)=delete
 
 UDPClient (const UDPClient &)=delete
 
 ~UDPClient ()=default
 
ssize_t Connect (const std::string &remote_address, uint16_t remote_port)
 The remote_address | remote_port is the address to which datagrams are sent. 1:1 association me->remote. More...
 
void Send (const std::string &rem_hostname, uint16_t rem_port, const std::byte *msg, size_t len)
 Send one UDP packet to a remote server. The client caches the the remote server's addrinfo after resolving it for the first time. After the first time, sending data does not require expensive addrinfo resolution. More...
 
void Send (const std::byte *msg, size_t len)
 Send one UDP packet to the connected remote server. More...
 
void EnableRecording ()
 

Private Attributes

UDPComm comm_object_
 

Constructor & Destructor Documentation

◆ UDPClient() [1/4]

UDPClient::UDPClient ( const std::string &  src_addr,
uint16_t  src_port,
size_t  tx_buffer_size = 0 
)
inlineexplicit

◆ UDPClient() [2/4]

UDPClient::UDPClient ( uint16_t  src_port)
inlineexplicit

◆ UDPClient() [3/4]

UDPClient::UDPClient ( const std::string &  src_addr)
inlineexplicit

◆ UDPClient() [4/4]

UDPClient::UDPClient ( const UDPClient )
delete

◆ ~UDPClient()

UDPClient::~UDPClient ( )
default

Member Function Documentation

◆ Connect()

ssize_t UDPClient::Connect ( const std::string &  remote_address,
uint16_t  remote_port 
)
inline

The remote_address | remote_port is the address to which datagrams are sent. 1:1 association me->remote.

Parameters
remote_addressHostname or IP address of the remote server
remote_portUDP port that the remote server is listening on
Here is the call graph for this function:
Here is the caller graph for this function:

◆ EnableRecording()

void UDPClient::EnableRecording ( )
inline
Here is the call graph for this function:

◆ operator=()

UDPClient& UDPClient::operator= ( const UDPClient )
delete

◆ Send() [1/2]

void UDPClient::Send ( const std::byte *  msg,
size_t  len 
)
inline

Send one UDP packet to the connected remote server.

Parameters
msgPointer to the message to send
lenLength in bytes of the message to send
Here is the call graph for this function:

◆ Send() [2/2]

void UDPClient::Send ( const std::string &  rem_hostname,
uint16_t  rem_port,
const std::byte *  msg,
size_t  len 
)
inline

Send one UDP packet to a remote server. The client caches the the remote server's addrinfo after resolving it for the first time. After the first time, sending data does not require expensive addrinfo resolution.

Parameters
rem_hostnameHostname or IP address of the remote server
rem_portUDP port that the remote server is listening on
msgPointer to the message to send
lenLength in bytes of the message to send
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ comm_object_

UDPComm UDPClient::comm_object_
private

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