Receive-only UDP socket for the sonar's data stream.
More...
#include <waterlinkedsonar/udp_socket.hpp>
|
| struct | Datagram |
| | Byte count and sender address of one received datagram. More...
|
| |
|
| | UdpSocket (UdpSocketConfig config) |
| | Opens and binds the socket, requests SO_RCVBUF, and in multicast mode sets SO_REUSEADDR and joins the group.
|
| |
| | ~UdpSocket () |
| |
| | UdpSocket (const UdpSocket &)=delete |
| |
| UdpSocket & | operator= (const UdpSocket &)=delete |
| |
| std::optional< Datagram > | recv (std::uint8_t *buf, std::size_t buf_size, std::chrono::milliseconds timeout) |
| | Blocks up to timeout for one datagram, written to buf.
|
| |
| std::uint16_t | local_port () const |
| | The bound port; differs from the configured one only when it was 0.
|
| |
Receive-only UDP socket for the sonar's data stream.
Carries raw datagrams; decoding is the caller's job.
◆ UdpSocket() [1/2]
Opens and binds the socket, requests SO_RCVBUF, and in multicast mode sets SO_REUSEADDR and joins the group.
- Parameters
-
- Exceptions
-
| std::system_error | on failure, including EADDRINUSE when another unicast socket already holds the port. |
◆ ~UdpSocket()
| waterlinked::sonar::UdpSocket::~UdpSocket |
( |
| ) |
|
◆ UdpSocket() [2/2]
| waterlinked::sonar::UdpSocket::UdpSocket |
( |
const UdpSocket & |
| ) |
|
|
delete |
◆ local_port()
| std::uint16_t waterlinked::sonar::UdpSocket::local_port |
( |
| ) |
const |
The bound port; differs from the configured one only when it was 0.
◆ operator=()
◆ recv()
| std::optional< Datagram > waterlinked::sonar::UdpSocket::recv |
( |
std::uint8_t * |
buf, |
|
|
std::size_t |
buf_size, |
|
|
std::chrono::milliseconds |
timeout |
|
) |
| |
Blocks up to timeout for one datagram, written to buf.
- Returns
- The datagram's size and source, or nullopt on timeout.
- Exceptions
-
| std::system_error | on socket errors. |
The documentation for this class was generated from the following file: