mavtables
0.2.1
MAVLink router and firewall.
|
#include <UDPSocket.hpp>
Public Member Functions | |
virtual | ~UDPSocket () |
virtual void | send (const std::vector< uint8_t > &data, const IPAddress &address) |
virtual void | send (std::vector< uint8_t >::const_iterator first, std::vector< uint8_t >::const_iterator last, const IPAddress &address) |
virtual std::pair< std::vector< uint8_t >, IPAddress > | receive (const std::chrono::nanoseconds &timeout=std::chrono::nanoseconds::zero()) |
virtual IPAddress | receive (std::back_insert_iterator< std::vector< uint8_t >> it, const std::chrono::nanoseconds &timeout=std::chrono::nanoseconds::zero()) |
Protected Member Functions | |
virtual std::ostream & | print_ (std::ostream &os) const |
Friends | |
std::ostream & | operator<< (std::ostream &os, const UDPSocket &udp_socket) |
A UDP socket, listening on a port/address combination.
Definition at line 46 of file UDPSocket.hpp.
|
virtual |
Definition at line 31 of file UDPSocket.cpp.
|
protectedvirtual |
Print the UDP socket to the given output stream.
os | The output stream to print to. |
Reimplemented in UnixUDPSocket.
Definition at line 112 of file UDPSocket.cpp.
|
virtual |
Receive data on the socket.
timeout
is not guaranteed to be up to nanosecond precision, the actual precision is up to the operating system's implementation but is guaranteed to have at least millisecond precision.timeout | How long to wait for data to arrive on the socket. The default is to not wait. |
Reimplemented in UnixUDPSocket.
Definition at line 77 of file UDPSocket.cpp.
|
virtual |
Receive data on the socket.
timeout
is not guaranteed to be up to nanosecond precision, the actual precision is up to the operating system's implementation but is guaranteed to have at least millisecond precision.it | A back insert iterator to read bytes into. |
timeout | How long to wait for data to arrive on the socket. The default is to not wait. |
Definition at line 97 of file UDPSocket.cpp.
References receive().
|
virtual |
Send data to the given address using the socket.
data | The bytes to send. |
address | The IP address (with port number) to send the bytes to, using UDP. |
Reimplemented in UnixUDPSocket.
Definition at line 43 of file UDPSocket.cpp.
|
virtual |
Send data to the given address using the socket.
first | Iterator to first byte in range to send. |
last | Iterator to one past the last byte to send. |
address | The IP address (with port number) to send the bytes to, using UDP. |
Definition at line 56 of file UDPSocket.cpp.
References send().
|
friend |
Print the given UDP socket to the given output stream.
An example:
The base UDPSocket class will print:
os | The output stream to print to. |
udp_socket | The UDP socket (or any child of UDPSocket) to print. |
Definition at line 140 of file UDPSocket.cpp.