C++ Actor Framework 1.0.0
Loading...
Searching...
No Matches
caf::net::stream_socket Struct Reference

A connection-oriented network communication endpoint for bidirectional byte streams. More...

#include <stream_socket.hpp>

Inheritance diagram for caf::net::stream_socket:
caf::net::network_socket caf::net::socket caf::detail::comparable< socket > caf::net::tcp_stream_socket

Public Types

using super = network_socket
 The parent type.
 
using transport_type = octet_stream::transport
 The default transport for exchanging raw bytes over a stream socket.
 
- Public Types inherited from caf::net::network_socket
using super = socket
 

Public Member Functions

constexpr stream_socket fd () const noexcept
 
- Public Member Functions inherited from caf::net::socket
constexpr socket (socket_id id) noexcept
 
constexpr socket (const socket &other) noexcept=default
 
socketoperator= (const socket &other) noexcept=default
 
constexpr signed_socket_id compare (socket other) const noexcept
 
constexpr operator bool () const noexcept
 
constexpr bool operator! () const noexcept
 
constexpr socket fd () const noexcept
 

Related Symbols

(Note that these are not member symbols.)

expected< std::pair< stream_socket, stream_socket > > CAF_NET_EXPORT make_stream_socket_pair ()
 Creates two connected sockets to mimic network communication (usually for testing purposes).
 
error CAF_NET_EXPORT nodelay (stream_socket x, bool new_value)
 Enables or disables Nagle's algorithm on x.
 
ptrdiff_t CAF_NET_EXPORT read (stream_socket x, byte_span buf)
 Receives data from x.
 
ptrdiff_t CAF_NET_EXPORT write (stream_socket x, const_byte_span buf)
 Sends data to x.
 
ptrdiff_t CAF_NET_EXPORT write (stream_socket x, std::initializer_list< const_byte_span > bufs)
 Transmits data from x to its peer.
 

Additional Inherited Members

- Public Attributes inherited from caf::net::socket
socket_id id
 

Detailed Description

A connection-oriented network communication endpoint for bidirectional byte streams.

Friends And Related Symbol Documentation

◆ read()

ptrdiff_t CAF_NET_EXPORT read ( stream_socket x,
byte_span buf )
related

Receives data from x.

Parameters
xA connected socket.
bufPoints to destination buffer.
Returns
The number of received bytes on success, 0 if the socket is closed, or -1 in case of an error.
Postcondition
Either the functions returned a non-negative integer or the caller can retrieve the error code by calling last_socket_error().

◆ write() [1/2]

ptrdiff_t CAF_NET_EXPORT write ( stream_socket x,
const_byte_span buf )
related

Sends data to x.

Parameters
xA connected endpoint.
bufPoints to the message to send.
Returns
The number of received bytes on success, 0 if the socket is closed, or -1 in case of an error.
Postcondition
either the result is a sec or a positive (non-zero) integer

◆ write() [2/2]

ptrdiff_t CAF_NET_EXPORT write ( stream_socket x,
std::initializer_list< const_byte_span > bufs )
related

Transmits data from x to its peer.

Parameters
xA connected endpoint.
bufsPoints to the message to send, scattered across up to 10 buffers.
Returns
The number of written bytes on success, otherwise an error code.
Postcondition
either the result is a sec or a positive (non-zero) integer
Precondition
bufs.size() < 10

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