Agora
1.2.0
Agora project
|
Go to the documentation of this file.
23 explicit UDPComm(std::string local_addr, uint16_t local_port,
24 size_t rx_buffer_size,
size_t tx_buffer_size);
26 explicit UDPComm(std::string local_addr,
const std::string& local_port,
27 size_t rx_buffer_size,
size_t tx_buffer_size);
40 ssize_t
Connect(
const std::string& remote_address,
41 uint16_t remote_port)
const;
42 ssize_t
Connect(
const std::string& remote_address,
43 const std::string& remote_port)
const;
56 void Send(
const std::string& rem_hostname, uint16_t rem_port,
75 ssize_t
Recv(
const std::string& src_address, uint16_t
src_port,
114 #endif // UDP_CLIENT_H_
std::mutex map_insert_access_
Variable to control write access to the non-thread safe data structures.
Definition: udp_comm.h:101
byte
Definition: core.h:388
Declaration file for the UDPComm class. This class is used to send messages and receive messages from...
UDPComm(std::string local_addr, uint16_t local_port, size_t rx_buffer_size, size_t tx_buffer_size)
Definition: udp_comm.cc:23
void MakeBlocking(size_t rx_timeout_sec=0) const
Configures the socket in blocking mode. Any calls to recv / send will now block.
Definition: udp_comm.cc:449
Definition: udp_comm.h:18
uint16_t src_port
Definition: eth_common.h:60
~UDPComm()
Definition: udp_comm.cc:185
::addrinfo * GetAddressInfo(const std::string &address, const std::string &port)
Definition: network_utils.cc:181
Helper definations for networking.
#define AGORA_LOG_ERROR(...)
Definition: logger.h:39
static constexpr bool kDebugPrintUdpSend
Definition: udp_comm.h:21
#define AGORA_LOG_TRACE(...)
Definition: logger.h:92
static constexpr bool kDebugPrintUdpInit
Definition: udp_comm.h:20
void close()
Definition: matplotlibcpp.h:2567
int sock_fd_
The raw socket file descriptor.
Definition: udp_comm.h:91
uint16_t len
Definition: eth_common.h:62
Plot Rx waveform for u
Definition: inspect_single_frame.m:108
ssize_t Recv(std::byte *buf, size_t len) const
Try to receive up to len bytes in buf by default this will not block.
Definition: udp_comm.cc:372
ssize_t Connect(const std::string &remote_address, uint16_t remote_port) const
The remote_address | remote_port is the address to which datagrams are sent. 1:1 association me<->rem...
Definition: udp_comm.cc:250
uint16_t check
Definition: eth_common.h:69
std::map< std::string, addrinfo * > addrinfo_map_
A cache mapping hostname:udp_port to addrinfo.
Definition: udp_comm.h:96
void EnableRecording()
Definition: udp_comm.h:79
#define AGORA_LOG_INFO(...)
Definition: logger.h:62
Definition: json.hpp:5213
#define AGORA_LOG_WARN(...)
Definition: logger.h:53
bool enable_recording_flag_
If set to ture, we record all sent packets, otherwise we dont.
Definition: udp_comm.h:111
std::string to_string() const
Definition: eth_common.h:64
static const std::string kDefaultAddress
Default to ipv4 for historic reasons, use ::1 if you want ipv6.
Definition: udp_comm.cc:21
static constexpr bool kDebugPrintUdpRecv
Definition: udp_comm.h:22
void PrintAddressInfo(const ::addrinfo *print_info)
Definition: network_utils.cc:229
UDPComm & operator=(const UDPComm &)=delete
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 reso...
Definition: udp_comm.cc:270
std::vector< std::vector< uint8_t > > sent_vec_
All packets sent, maintained if recording is enabled.
Definition: udp_comm.h:106