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

A TCP stream socket. More...

Inheritance diagram for idfxx::net::stream_socket:

Classes

struct  config
 Stream socket configuration. More...
 

Public Member Functions

 stream_socket ()
 Creates a new TCP socket with default configuration (IPv4, blocking).
 
 stream_socket (address_family fam)
 Creates a new TCP socket of the given address family.
 
 stream_socket (const config &cfg)
 Creates a new TCP socket with the given configuration.
 
 stream_socket (const endpoint &peer)
 Creates a TCP socket and synchronously connects to the peer.
 
 stream_socket (const endpoint &peer, const config &cfg)
 Creates a TCP socket with the given configuration and connects to the peer.
 
 stream_socket (std::string_view host, port_number port)
 Resolves host : port and connects to the first reachable endpoint, using default socket configuration.
 
 stream_socket (std::string_view host, port_number port, const config &cfg, const resolver_options &opts={})
 Resolves host : port and connects to the first reachable endpoint.
 
template<typename Rep , typename Period >
 stream_socket (std::string_view host, port_number port, const std::chrono::duration< Rep, Period > &timeout)
 Resolves host : port and connects to the first reachable endpoint, using default socket configuration and a per-candidate timeout.
 
template<typename Rep , typename Period >
 stream_socket (std::string_view host, port_number port, const std::chrono::duration< Rep, Period > &timeout, const config &cfg, const resolver_options &opts={})
 Resolves host : port and connects to the first reachable endpoint, bounding each per-candidate attempt by timeout.
 
template<typename Rep , typename Period >
void connect_for (const endpoint &peer, const std::chrono::duration< Rep, Period > &timeout)
 Connects the socket with a bounded timeout.
 
template<typename Rep , typename Period >
result< voidtry_connect_for (const endpoint &peer, const std::chrono::duration< Rep, Period > &timeout)
 Connects the socket with a bounded timeout.
 
size_t send (std::span< const std::byte > buf)
 Sends bytes on the connected socket.
 
result< size_ttry_send (std::span< const std::byte > buf)
 Sends bytes on the connected socket.
 
size_t send (std::string_view buf)
 Sends a string view on the connected socket.
 
result< size_ttry_send (std::string_view buf)
 Sends a string view on the connected socket.
 
void send_all (std::span< const std::byte > buf)
 Sends buf in full, retrying on partial sends.
 
result< voidtry_send_all (std::span< const std::byte > buf)
 Sends buf in full, retrying on partial sends.
 
void send_all (std::string_view buf)
 Sends a string view in full, retrying on partial sends.
 
result< voidtry_send_all (std::string_view buf)
 Sends a string view in full, retrying on partial sends.
 
void recv_exact (std::span< std::byte > buf)
 Receives until buf is filled, treating premature close as an error.
 
result< voidtry_recv_exact (std::span< std::byte > buf)
 Receives until buf is filled, treating premature close as an error.
 
void shutdown ()
 Shuts down both directions on the socket.
 
result< voidtry_shutdown ()
 Shuts down both directions on the socket.
 
void shutdown (direction dir)
 Shuts down one direction on the socket (half-close).
 
result< voidtry_shutdown (direction dir)
 Shuts down one direction on the socket (half-close).
 
void set_no_delay (bool on) noexcept
 Toggles whether Nagle's algorithm is disabled — when on, small writes are sent immediately rather than being coalesced.
 
void set_keep_alive (bool on) noexcept
 Toggles TCP keep-alive — periodic probes on idle connections to detect dead peers.
 
template<typename Rep , typename Period >
void set_keep_idle (const std::chrono::duration< Rep, Period > &t) noexcept
 Sets the time the connection must be idle before keep-alive probes start.
 
template<typename Rep , typename Period >
void set_keep_interval (const std::chrono::duration< Rep, Period > &t) noexcept
 Sets the interval between successive keep-alive probes.
 
void set_keep_count (uint32_t count) noexcept
 Sets the maximum number of unacknowledged keep-alive probes before the connection is dropped.
 
bool get_no_delay () const noexcept
 Returns whether Nagle's algorithm is currently disabled on this socket.
 
bool get_keep_alive () const noexcept
 Returns whether TCP keep-alive is currently enabled on this socket.
 

Static Public Member Functions

static result< stream_socketmake ()
 Creates a new TCP socket with default configuration (IPv4, blocking).
 
static result< stream_socketmake (address_family fam)
 Creates a new TCP socket of the given address family.
 
static result< stream_socketmake (const config &cfg)
 Creates a new TCP socket with the given configuration.
 
static result< stream_socketconnect_to (const endpoint &peer)
 Creates a TCP socket and synchronously connects to the peer.
 
static result< stream_socketconnect_to (const endpoint &peer, const config &cfg)
 Creates a TCP socket with the given configuration and connects to the peer.
 
static result< stream_socketconnect_to (std::string_view host, port_number port)
 Resolves host : port and connects to the first reachable endpoint, using default socket configuration.
 
static result< stream_socketconnect_to (std::string_view host, port_number port, const config &cfg, const resolver_options &opts={})
 Resolves host : port and connects to the first reachable endpoint.
 
template<typename Rep , typename Period >
static result< stream_socketconnect_to_for (std::string_view host, port_number port, const std::chrono::duration< Rep, Period > &timeout)
 Resolves host : port and connects to the first reachable endpoint, using default socket configuration and a per-candidate timeout.
 
template<typename Rep , typename Period >
static result< stream_socketconnect_to_for (std::string_view host, port_number port, const std::chrono::duration< Rep, Period > &timeout, const config &cfg, const resolver_options &opts={})
 Resolves host : port and connects to the first reachable endpoint, bounding each per-candidate attempt by timeout.
 

Friends

class listener
 

Detailed Description

A TCP stream socket.

Use idfxx::net::listener to accept inbound connections; this class is for outbound client connections and for the per-connection socket returned by the listener.

Ownership is exclusive: the socket is non-copyable and move-only. A moved-from socket may only be destroyed, move-assigned, or queried via is_open() (which returns false); calling any other method on it is undefined behavior. The destructor closes the socket if open.

The class is [[nodiscard]]: a connect-on-construct temporary that is discarded (e.g. stream_socket{peer}; as a statement) warns, since the connection it just opened would be immediately closed.

sock.set_recv_timeout(std::chrono::seconds(5));
std::array<std::byte, 256> buf;
auto data = sock.recv(buf);
Address/port pair identifying a transport endpoint.
Definition endpoint.hpp:129
IPv4 address value type.
Definition net.hpp:41
A TCP stream socket.
std::expected< T, std::error_code > result
result type wrapping a value or error code.
Definition error.hpp:120

Definition at line 58 of file stream_socket.hpp.

Constructor & Destructor Documentation

◆ stream_socket() [1/9]

idfxx::net::stream_socket::stream_socket ( )

Creates a new TCP socket with default configuration (IPv4, blocking).

Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled.
Exceptions
std::system_erroron failure.

◆ stream_socket() [2/9]

idfxx::net::stream_socket::stream_socket ( address_family  fam)
explicit

Creates a new TCP socket of the given address family.

Parameters
famAddress family.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled.
Exceptions
std::system_erroron failure.

◆ stream_socket() [3/9]

idfxx::net::stream_socket::stream_socket ( const config cfg)
explicit

Creates a new TCP socket with the given configuration.

Parameters
cfgSocket configuration.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled.
Exceptions
std::system_erroron failure.

◆ stream_socket() [4/9]

idfxx::net::stream_socket::stream_socket ( const endpoint peer)
explicit

Creates a TCP socket and synchronously connects to the peer.

Address family is taken from the peer endpoint.

Warning
This constructor blocks on the TCP handshake and throws std::system_error on a transient network failure (refused, unreachable, …). For a result-based or timed connect, use the connect_to / connect_to_for factories instead.
Parameters
peerRemote endpoint to connect to.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled.
Exceptions
std::system_erroron failure.

◆ stream_socket() [5/9]

idfxx::net::stream_socket::stream_socket ( const endpoint peer,
const config cfg 
)
explicit

Creates a TCP socket with the given configuration and connects to the peer.

Address family is taken from the peer endpoint and overrides cfg.family.

Warning
This constructor blocks on the TCP handshake and throws std::system_error on a transient network failure.
Parameters
peerRemote endpoint to connect to.
cfgSocket configuration.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled.
Exceptions
std::system_erroron failure.

◆ stream_socket() [6/9]

idfxx::net::stream_socket::stream_socket ( std::string_view  host,
port_number  port 
)
explicit

Resolves host : port and connects to the first reachable endpoint, using default socket configuration.

Equivalent to connect_to(host, port, {}, {}). See the four-argument overload for the full semantics.

Warning
This constructor performs a blocking DNS resolution and TCP connect, and throws std::system_error on resolution failure or a transient network failure. For a result-based or timed connect, use the connect_to / connect_to_for factories instead.
Parameters
hostHost name or numeric address.
portPort number in host byte order.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled.
Exceptions
std::system_erroron resolution failure or if every candidate fails to connect.

◆ stream_socket() [7/9]

idfxx::net::stream_socket::stream_socket ( std::string_view  host,
port_number  port,
const config cfg,
const resolver_options opts = {} 
)
explicit

Resolves host : port and connects to the first reachable endpoint.

Endpoints are tried in resolution order. The first successful connection wins; if every candidate fails, the last connect error is reported. If resolution succeeds but yields no candidates, throws errc::name_not_found.

Warning
This constructor performs a blocking DNS resolution and TCP connect, and throws std::system_error on resolution failure or a transient network failure.
Parameters
hostHost name or numeric address.
portPort number in host byte order.
cfgSocket configuration (cfg.family is overridden per candidate).
optsResolver options.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled.
Exceptions
std::system_erroron resolution failure or if every candidate fails to connect.

◆ stream_socket() [8/9]

template<typename Rep , typename Period >
idfxx::net::stream_socket::stream_socket ( std::string_view  host,
port_number  port,
const std::chrono::duration< Rep, Period > &  timeout 
)
explicit

Resolves host : port and connects to the first reachable endpoint, using default socket configuration and a per-candidate timeout.

Equivalent to connect_to_for(host, port, timeout, {}, {}). See the five-argument overload for the full semantics.

Warning
This constructor performs a blocking DNS resolution and TCP connect, and throws std::system_error on resolution failure or a transient network failure. For a result-based connect, use the connect_to_for factory instead.
Template Parameters
RepDuration representation.
PeriodDuration period.
Parameters
hostHost name or numeric address.
portPort number in host byte order.
timeoutPer-attempt timeout. Sub-millisecond resolutions are rounded up.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled.
Exceptions
std::system_erroron resolution failure or if every candidate fails to connect.

Definition at line 700 of file stream_socket.hpp.

◆ stream_socket() [9/9]

template<typename Rep , typename Period >
idfxx::net::stream_socket::stream_socket ( std::string_view  host,
port_number  port,
const std::chrono::duration< Rep, Period > &  timeout,
const config cfg,
const resolver_options opts = {} 
)
inlineexplicit

Resolves host : port and connects to the first reachable endpoint, bounding each per-candidate attempt by timeout.

The timeout is applied per candidate, not as a total deadline — total time may reach N × timeout if every candidate hangs to the limit.

Warning
This constructor performs a blocking DNS resolution and TCP connect, and throws std::system_error on resolution failure or a transient network failure.
Template Parameters
RepDuration representation.
PeriodDuration period.
Parameters
hostHost name or numeric address.
portPort number in host byte order.
timeoutPer-attempt timeout. Sub-millisecond resolutions are rounded up.
cfgSocket configuration (cfg.family is overridden per candidate).
optsResolver options.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled.
Exceptions
std::system_erroron resolution failure or if every candidate fails to connect.

Definition at line 346 of file stream_socket.hpp.

Member Function Documentation

◆ connect_for()

template<typename Rep , typename Period >
void idfxx::net::stream_socket::connect_for ( const endpoint peer,
const std::chrono::duration< Rep, Period > &  timeout 
)
inline

Connects the socket with a bounded timeout.

Parameters
peerRemote endpoint to connect to.
timeoutMaximum time to wait for the handshake. Sub-millisecond resolutions are rounded up.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled.
Exceptions
std::system_errorif the timeout fires or on other failure.

Definition at line 416 of file stream_socket.hpp.

References idfxx::timeout, and idfxx::unwrap().

◆ connect_to() [1/4]

static result< stream_socket > idfxx::net::stream_socket::connect_to ( const endpoint peer)
static

Creates a TCP socket and synchronously connects to the peer.

Parameters
peerRemote endpoint to connect to.
Returns
The connected socket, or an error.

◆ connect_to() [2/4]

static result< stream_socket > idfxx::net::stream_socket::connect_to ( const endpoint peer,
const config cfg 
)
static

Creates a TCP socket with the given configuration and connects to the peer.

Parameters
peerRemote endpoint to connect to.
cfgSocket configuration.
Returns
The connected socket, or an error.

◆ connect_to() [3/4]

static result< stream_socket > idfxx::net::stream_socket::connect_to ( std::string_view  host,
port_number  port 
)
static

Resolves host : port and connects to the first reachable endpoint, using default socket configuration.

The std::string_view host selects this resolving overload; pass an endpoint to connect directly without resolution.

Equivalent to connect_to(host, port, {}, {}). See the four-argument overload for the full semantics.

Parameters
hostHost name or numeric address.
portPort number in host byte order.
Returns
The connected socket, or an error.

◆ connect_to() [4/4]

static result< stream_socket > idfxx::net::stream_socket::connect_to ( std::string_view  host,
port_number  port,
const config cfg,
const resolver_options opts = {} 
)
static

Resolves host : port and connects to the first reachable endpoint.

Endpoints are tried in resolution order. The first successful connection wins; if every candidate fails, the last connect error is returned. If resolution succeeds but yields no candidates, returns errc::name_not_found.

Parameters
hostHost name or numeric address.
portPort number in host byte order.
cfgSocket configuration (cfg.family is overridden per candidate).
optsResolver options.
Returns
The connected socket, or an error.

◆ connect_to_for() [1/2]

template<typename Rep , typename Period >
result< stream_socket > idfxx::net::stream_socket::connect_to_for ( std::string_view  host,
port_number  port,
const std::chrono::duration< Rep, Period > &  timeout 
)
static

Resolves host : port and connects to the first reachable endpoint, using default socket configuration and a per-candidate timeout.

Equivalent to connect_to_for(host, port, timeout, {}, {}). See the five-argument overload for the full semantics.

Template Parameters
RepDuration representation.
PeriodDuration period.
Parameters
hostHost name or numeric address.
portPort number in host byte order.
timeoutPer-attempt timeout. Sub-millisecond resolutions are rounded up.
Returns
The connected socket, or an error such as errc::timed_out.

Definition at line 690 of file stream_socket.hpp.

References connect_to_for(), and idfxx::timeout.

Referenced by connect_to_for().

◆ connect_to_for() [2/2]

template<typename Rep , typename Period >
static result< stream_socket > idfxx::net::stream_socket::connect_to_for ( std::string_view  host,
port_number  port,
const std::chrono::duration< Rep, Period > &  timeout,
const config cfg,
const resolver_options opts = {} 
)
inlinestatic

Resolves host : port and connects to the first reachable endpoint, bounding each per-candidate attempt by timeout.

The timeout is applied per candidate, not as a total deadline — total time may reach N × timeout if every candidate hangs to the limit. If every candidate fails (with errc::timed_out or otherwise), the last error is returned.

Template Parameters
RepDuration representation.
PeriodDuration period.
Parameters
hostHost name or numeric address.
portPort number in host byte order.
timeoutPer-attempt timeout. Sub-millisecond resolutions are rounded up.
cfgSocket configuration (cfg.family is overridden per candidate).
optsResolver options.
Returns
The connected socket, or an error such as errc::timed_out.

Definition at line 392 of file stream_socket.hpp.

◆ get_keep_alive()

bool idfxx::net::stream_socket::get_keep_alive ( ) const
noexcept

Returns whether TCP keep-alive is currently enabled on this socket.

Reads back the POSIX SO_KEEPALIVE option.

◆ get_no_delay()

bool idfxx::net::stream_socket::get_no_delay ( ) const
noexcept

Returns whether Nagle's algorithm is currently disabled on this socket.

Reads back the POSIX TCP_NODELAY option.

◆ make() [1/3]

static result< stream_socket > idfxx::net::stream_socket::make ( )
static

Creates a new TCP socket with default configuration (IPv4, blocking).

Returns
The new socket, or an error.

◆ make() [2/3]

static result< stream_socket > idfxx::net::stream_socket::make ( address_family  fam)
static

Creates a new TCP socket of the given address family.

Parameters
famAddress family.
Returns
The new socket, or an error.

◆ make() [3/3]

static result< stream_socket > idfxx::net::stream_socket::make ( const config cfg)
static

Creates a new TCP socket with the given configuration.

Parameters
cfgSocket configuration.
Returns
The new socket, or an error.

◆ recv_exact()

void idfxx::net::stream_socket::recv_exact ( std::span< std::byte >  buf)
inline

Receives until buf is filled, treating premature close as an error.

Parameters
bufBuffer to fill exactly.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled.
Exceptions
std::system_errorif the peer closes early or on other failure.

Definition at line 538 of file stream_socket.hpp.

References idfxx::unwrap().

◆ send() [1/2]

size_t idfxx::net::stream_socket::send ( std::span< const std::byte >  buf)
inline

Sends bytes on the connected socket.

May send fewer bytes than requested. See send_all for a helper that retries until the buffer is fully drained.

Parameters
bufData to send.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled.
Exceptions
std::system_erroron failure.
Returns
Number of bytes sent.

Definition at line 454 of file stream_socket.hpp.

References idfxx::unwrap().

◆ send() [2/2]

size_t idfxx::net::stream_socket::send ( std::string_view  buf)
inline

Sends a string view on the connected socket.

Parameters
bufData to send.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled.
Exceptions
std::system_erroron failure.
Returns
Number of bytes sent.

Definition at line 476 of file stream_socket.hpp.

References idfxx::unwrap().

◆ send_all() [1/2]

void idfxx::net::stream_socket::send_all ( std::span< const std::byte >  buf)
inline

Sends buf in full, retrying on partial sends.

Parameters
bufData to send.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled.
Exceptions
std::system_erroron failure.

Definition at line 496 of file stream_socket.hpp.

References idfxx::unwrap().

◆ send_all() [2/2]

void idfxx::net::stream_socket::send_all ( std::string_view  buf)
inline

Sends a string view in full, retrying on partial sends.

Parameters
bufData to send.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled.
Exceptions
std::system_erroron failure.

Definition at line 516 of file stream_socket.hpp.

References idfxx::unwrap().

◆ set_keep_alive()

void idfxx::net::stream_socket::set_keep_alive ( bool  on)
noexcept

Toggles TCP keep-alive — periodic probes on idle connections to detect dead peers.

Equivalent to the POSIX SO_KEEPALIVE socket option.

Parameters
onWhether to enable keep-alive.

◆ set_keep_count()

void idfxx::net::stream_socket::set_keep_count ( uint32_t  count)
noexcept

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

Equivalent to the POSIX TCP_KEEPCNT option.

Parameters
countMaximum probe count.

◆ set_keep_idle()

template<typename Rep , typename Period >
void idfxx::net::stream_socket::set_keep_idle ( const std::chrono::duration< Rep, Period > &  t)
inlinenoexcept

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

Equivalent to the POSIX TCP_KEEPIDLE option. Sub-second resolutions are rounded up.

Parameters
tIdle time.

Definition at line 626 of file stream_socket.hpp.

◆ set_keep_interval()

template<typename Rep , typename Period >
void idfxx::net::stream_socket::set_keep_interval ( const std::chrono::duration< Rep, Period > &  t)
inlinenoexcept

Sets the interval between successive keep-alive probes.

Equivalent to the POSIX TCP_KEEPINTVL option. Sub-second resolutions are rounded up.

Parameters
tInterval between probes.

Definition at line 637 of file stream_socket.hpp.

◆ set_no_delay()

void idfxx::net::stream_socket::set_no_delay ( bool  on)
noexcept

Toggles whether Nagle's algorithm is disabled — when on, small writes are sent immediately rather than being coalesced.

Equivalent to the POSIX TCP_NODELAY socket option.

Parameters
onWhether to disable Nagle's algorithm.

◆ shutdown() [1/2]

void idfxx::net::stream_socket::shutdown ( )
inline

Shuts down both directions on the socket.

Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled.
Exceptions
std::system_erroron failure.

Definition at line 559 of file stream_socket.hpp.

References idfxx::unwrap().

◆ shutdown() [2/2]

void idfxx::net::stream_socket::shutdown ( direction  dir)
inline

Shuts down one direction on the socket (half-close).

The two directions are independent: after shutdown(direction::send) the peer sees end-of-stream but local recv keeps returning any data the peer sends until it closes; after shutdown(direction::receive) further local reads return end-of-stream while sends still succeed.

Parameters
dirDirection to shut down.
Note
Only available when CONFIG_COMPILER_CXX_EXCEPTIONS is enabled.
Exceptions
std::system_erroron failure.

Definition at line 583 of file stream_socket.hpp.

References idfxx::unwrap().

◆ try_connect_for()

template<typename Rep , typename Period >
result< void > idfxx::net::stream_socket::try_connect_for ( const endpoint peer,
const std::chrono::duration< Rep, Period > &  timeout 
)
inline

Connects the socket with a bounded timeout.

Returns once the connection is established, the timeout elapses, or the connection attempt fails.

Parameters
peerRemote endpoint to connect to.
timeoutMaximum time to wait for the handshake. Sub-millisecond resolutions are rounded up.
Returns
Success, or an error such as errc::timed_out.

Definition at line 434 of file stream_socket.hpp.

References idfxx::timeout.

◆ try_recv_exact()

result< void > idfxx::net::stream_socket::try_recv_exact ( std::span< std::byte >  buf)

Receives until buf is filled, treating premature close as an error.

Parameters
bufBuffer to fill exactly.
Returns
Success, or an error (errc::unexpected_eof if the peer closed before buf was fully received).

◆ try_send() [1/2]

result< size_t > idfxx::net::stream_socket::try_send ( std::span< const std::byte >  buf)

Sends bytes on the connected socket.

Parameters
bufData to send.
Returns
Number of bytes sent, or an error.

◆ try_send() [2/2]

result< size_t > idfxx::net::stream_socket::try_send ( std::string_view  buf)

Sends a string view on the connected socket.

Parameters
bufData to send.
Returns
Number of bytes sent, or an error.

◆ try_send_all() [1/2]

result< void > idfxx::net::stream_socket::try_send_all ( std::span< const std::byte >  buf)

Sends buf in full, retrying on partial sends.

Parameters
bufData to send.
Returns
Success, or an error.

◆ try_send_all() [2/2]

result< void > idfxx::net::stream_socket::try_send_all ( std::string_view  buf)

Sends a string view in full, retrying on partial sends.

Parameters
bufData to send.
Returns
Success, or an error.

◆ try_shutdown() [1/2]

result< void > idfxx::net::stream_socket::try_shutdown ( )

Shuts down both directions on the socket.

Returns
Success, or an error.

◆ try_shutdown() [2/2]

result< void > idfxx::net::stream_socket::try_shutdown ( direction  dir)

Shuts down one direction on the socket (half-close).

The two directions are independent: after shutdown(direction::send) the peer sees end-of-stream but local recv keeps returning any data the peer sends until it closes; after shutdown(direction::receive) further local reads return end-of-stream while sends still succeed.

Parameters
dirDirection to shut down.
Returns
Success, or an error.

Friends And Related Symbol Documentation

◆ listener

Definition at line 664 of file stream_socket.hpp.


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