20#include <idfxx/net/endpoint>
21#include <idfxx/net/error>
22#include <idfxx/net/stream_socket>
67 static constexpr int default_backlog = 5;
77 int backlog = default_backlog;
81 bool reuse_address =
true;
82#ifdef CONFIG_LWIP_IPV6
92 bool non_blocking =
false;
95 std::optional<std::string_view> bind_to_device = std::nullopt;
100#ifdef CONFIG_COMPILER_CXX_EXCEPTIONS
191#ifdef CONFIG_COMPILER_CXX_EXCEPTIONS
224 template<
typename Rep,
typename Period>
250 template<
typename Rep,
typename Period>
252 return _try_accept_for(std::chrono::ceil<std::chrono::milliseconds>(
timeout));
257 : ip_socket_base(
fd,
fam) {}
Address/port pair identifying a transport endpoint.
static result< listener > make(const endpoint &bind_addr)
Creates and listens on a TCP listener at the given address.
stream_socket accept_for(const std::chrono::duration< Rep, Period > &timeout)
Accepts a single connection within the given timeout.
static result< listener > make(port_number port, const config &cfg)
Creates a TCP listener bound to all local interfaces on the given port.
static result< listener > make(port_number port)
Creates a TCP listener bound to all local interfaces on the given port.
stream_socket accept()
Accepts a single incoming connection.
result< stream_socket > try_accept_for(const std::chrono::duration< Rep, Period > &timeout)
Accepts a single connection within the given timeout.
listener(port_number port)
Creates a TCP listener bound to all local interfaces on the given port.
listener(const endpoint &bind_addr)
Creates and listens on a TCP listener at the given address.
accepted_connection accept_with_peer()
Accepts a single incoming connection and returns the peer's endpoint.
static result< listener > make(const endpoint &bind_addr, const config &cfg)
Creates and listens on a TCP listener with the given configuration.
result< accepted_connection > try_accept_with_peer()
Accepts a single incoming connection and returns the peer's endpoint.
result< stream_socket > try_accept()
Accepts a single incoming connection.
listener(const endpoint &bind_addr, const config &cfg)
Creates and listens on a TCP listener with the given configuration.
listener(port_number port, const config &cfg)
Creates a TCP listener bound to all local interfaces on the given port.
address_family
Address family.
uint16_t port_number
Port number type for transport endpoints.
T unwrap(result< T > result)
Throws a std::system_error if the result is an error.
@ timeout
Operation timed out.
std::expected< T, std::error_code > result
result type wrapping a value or error code.
Result of accept_with_peer / try_accept_with_peer — a newly accepted connection together with the pee...
endpoint peer
The peer's address and port.
stream_socket socket
The connected client socket.