A handle to an established, reliable, datagram-oriented transport socket.
ReliableSocket is the interface for reading and writing datagrams over some underlying transport. All reads and writes operate using Buf objects, which represent views into some memory region specific to the socket. This makes zero-copy reads and writes possible, if the implementation chooses to support it.
Datagrams are delivered reliably and in order. If a packet cannot be delivered in order, the socket must close.
Any ReliableSocket can be implicitly converted to a Socket (by value, rvalue, or const reference).
The underlying socket begins established and open, but may close at any time. Once closed, all operations on the socket will report failures. A ReliableSocket cannot be reopened. A new one must be provisioned from a ReliableListener or a ReliableConnector.
A ReliableSocket is cheaply copyable and always safe to access, ensuring that the underlying socket state is valid as long as a handle is held. Users should drop their handles once no longer needed to ensure prompt resource reclamation.
Public Member Functions | |
| constexpr | ReliableSocket (std::nullptr_t) |
| ReliableSocket (const ReliableSocket &other)=default | |
| ReliableSocket (ReliableSocket &&other) noexcept=default | |
| ReliableSocket & | operator= (const ReliableSocket &other)=default |
| ReliableSocket & | operator= (ReliableSocket &&other) noexcept=default |
| constexpr | operator const Socket & () const noexcept |
| operator bool () const | |
| size_t | max_write_message_size_bytes () const |
The maximum size in bytes that can be requested in a ReserveWrite. | |
| size_t | max_read_message_size_bytes () const |
| The maximum size in bytes of a single datagram received from the peer. | |
| ReadFuture | Read () const |
| ReserveWriteFuture | ReserveWrite (size_t min_size_bytes) const |
| std::optional< WriteReservation > | TryReserveWrite (size_t min_size_bytes) const |
| CloseFuture | Close () const |
| CloseFuture | WhenClosed () const |
Friends | |
| class | Socket |
| class | ReliableSocketImpl |
| class | ReliableListener |
| class | ReliableConnector |
|
inline |
The maximum size in bytes of a single datagram received from the peer.
|
inline |
The maximum size in bytes that can be requested in a ReserveWrite.
|
inlineconstexprnoexcept |
A ReliableSocket can be used as a Socket. Conversion to a mutable Socket& is not supported, since that would permit assigning a Socket to a ReliableSocket through the reference.