Asynchronous datagram-oriented transport interface.
Main docs: Home
◆ Close()
| CloseFuture pw::transport::ReliableDatagramSocket::Close |
( |
| ) |
const |
|
inline |
Terminally closes the socket, resolving once it has been fully torn down. If the socket is already closed, this is a no-op.
◆ Read()
| ReadFuture pw::transport::ReliableDatagramSocket::Read |
( |
| ) |
const |
|
inline |
Receives a single datagram from the peer, resolving to a ConstBuf view of its data. Resolves to a null ConstBuf when the socket is closed.
Only one Read operation may be pended at a time. Pending a second ReadFuture while one is active will assert.
◆ ReserveWrite()
| ReserveWriteFuture pw::transport::ReliableDatagramSocket::ReserveWrite |
( |
size_t |
min_size_bytes | ) |
const |
|
inline |
Requests to write a datagram of size at least min_size_bytes, waiting for space to become available.
Resolves to a std::optional<WriteReservation> that allows writing to that buffer, or std::nullopt if the socket has closed.
Multiple reservations or reservation requests can be outstanding at once. If multiple pending requests exist, the order in which they are resolved is not specified.
Requesting larger than max_write_message_size_bytes will assert.
◆ TryReserveWrite()
| std::optional< WriteReservation > pw::transport::ReliableDatagramSocket::TryReserveWrite |
( |
size_t |
min_size_bytes | ) |
const |
|
inline |
Synchronously attempts to reserve space for writing a datagram of at least min_size_bytes. Returns std::nullopt if space is not immediately available or if the socket is closed.
◆ WhenClosed()
| CloseFuture pw::transport::ReliableDatagramSocket::WhenClosed |
( |
| ) |
const |
|
inline |
Returns a future that resolves when the socket is terminally closed or disconnected.