idfxx 1.0.0
Modern C++23 components for ESP-IDF
Loading...
Searching...
No Matches
idfxx::net::stream_socket::config Struct Reference

Stream socket configuration. More...

#include <idfxx_net/include/idfxx/net/stream_socket.hpp>

Public Attributes

address_family family = address_family::ipv4
 Address family (IPv4 / IPv6).
 
bool non_blocking = false
 If true, I/O calls return immediately when no data or buffer space is available rather than blocking the calling task.
 
std::optional< std::chrono::milliseconds > recv_timeout = std::nullopt
 Maximum time recv will block waiting for data before returning errc::timed_out.
 
std::optional< std::chrono::milliseconds > send_timeout = std::nullopt
 Maximum time send will block waiting for buffer space before returning errc::timed_out.
 
bool reuse_address = false
 Allow bind to reuse a local address that is still in TIME_WAIT.
 
bool no_delay = false
 Disable Nagle's algorithm — small writes go out immediately rather than being coalesced.
 
bool keep_alive = false
 Send periodic probes on idle TCP connections to detect dead peers.
 
std::optional< std::chrono::seconds > keep_idle = std::nullopt
 Time the connection must be idle before keep-alive probes start.
 
std::optional< std::chrono::seconds > keep_interval = std::nullopt
 Interval between successive keep-alive probes.
 
std::optional< uint32_tkeep_count = std::nullopt
 Maximum number of unacknowledged keep-alive probes before the connection is dropped.
 
std::optional< std::string_view > bind_to_device = std::nullopt
 Restrict the socket to a specific network interface, identified by name.
 

Detailed Description

Stream socket configuration.

Defaults produce a blocking IPv4 TCP socket. All fields except family correspond directly to options that can also be set later via the set_* methods.

Definition at line 67 of file stream_socket.hpp.

Member Data Documentation

◆ bind_to_device

std::optional<std::string_view> idfxx::net::stream_socket::config::bind_to_device = std::nullopt

Restrict the socket to a specific network interface, identified by name.

Equivalent to the POSIX SO_BINDTODEVICE option.

Definition at line 102 of file stream_socket.hpp.

◆ family

address_family idfxx::net::stream_socket::config::family = address_family::ipv4

Address family (IPv4 / IPv6).

Definition at line 68 of file stream_socket.hpp.

◆ keep_alive

bool idfxx::net::stream_socket::config::keep_alive = false

Send periodic probes on idle TCP connections to detect dead peers.

Equivalent to the POSIX SO_KEEPALIVE option.

Definition at line 85 of file stream_socket.hpp.

◆ keep_count

std::optional<uint32_t> idfxx::net::stream_socket::config::keep_count = std::nullopt

Maximum number of unacknowledged keep-alive probes before the connection is dropped.

Equivalent to the POSIX TCP_KEEPCNT option.

Definition at line 94 of file stream_socket.hpp.

◆ keep_idle

std::optional<std::chrono::seconds> idfxx::net::stream_socket::config::keep_idle = std::nullopt

Time the connection must be idle before keep-alive probes start.

Equivalent to the POSIX TCP_KEEPIDLE option.

Definition at line 88 of file stream_socket.hpp.

◆ keep_interval

std::optional<std::chrono::seconds> idfxx::net::stream_socket::config::keep_interval = std::nullopt

Interval between successive keep-alive probes.

Equivalent to the POSIX TCP_KEEPINTVL option.

Definition at line 91 of file stream_socket.hpp.

◆ no_delay

bool idfxx::net::stream_socket::config::no_delay = false

Disable Nagle's algorithm — small writes go out immediately rather than being coalesced.

Equivalent to the POSIX TCP_NODELAY option.

Definition at line 82 of file stream_socket.hpp.

◆ non_blocking

bool idfxx::net::stream_socket::config::non_blocking = false

If true, I/O calls return immediately when no data or buffer space is available rather than blocking the calling task.

Equivalent to the POSIX O_NONBLOCK flag.

Definition at line 71 of file stream_socket.hpp.

◆ recv_timeout

std::optional<std::chrono::milliseconds> idfxx::net::stream_socket::config::recv_timeout = std::nullopt

Maximum time recv will block waiting for data before returning errc::timed_out.

Definition at line 73 of file stream_socket.hpp.

◆ reuse_address

bool idfxx::net::stream_socket::config::reuse_address = false

Allow bind to reuse a local address that is still in TIME_WAIT.

Equivalent to the POSIX SO_REUSEADDR socket option.

Definition at line 79 of file stream_socket.hpp.

◆ send_timeout

std::optional<std::chrono::milliseconds> idfxx::net::stream_socket::config::send_timeout = std::nullopt

Maximum time send will block waiting for buffer space before returning errc::timed_out.

Definition at line 76 of file stream_socket.hpp.


The documentation for this struct was generated from the following file: