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

An internal endpoint for sending or receiving data. More...

#include <socket.hpp>

Inheritance diagram for caf::net::socket:
caf::detail::comparable< socket > caf::net::network_socket caf::net::pipe_socket caf::net::datagram_socket caf::net::stream_socket caf::net::tcp_accept_socket caf::net::udp_datagram_socket caf::net::tcp_stream_socket

Public Member Functions

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
 

Public Attributes

socket_id id
 

Related Symbols

(Note that these are not member symbols.)

using socket_id = int
 Platform-specific representation of a socket.
 
using signed_socket_id = std::make_signed_t<socket_id>
 Signed counterpart of socket_id.
 
template<class Inspector >
bool inspect (Inspector &f, socket &x)
 
void CAF_NET_EXPORT close (socket x)
 Closes socket x.
 
std::errc CAF_NET_EXPORT last_socket_error ()
 Returns the last socket error in this thread as an integer.
 
bool CAF_NET_EXPORT last_socket_error_is_temporary ()
 Checks whether last_socket_error() would return an error code that indicates a temporary error.
 
std::string CAF_NET_EXPORT last_socket_error_as_string ()
 Returns the last socket error as human-readable string.
 
bool CAF_NET_EXPORT probe (socket x)
 Queries whether x is a valid and connected socket by reading the socket option SO_ERROR.
 
error CAF_NET_EXPORT child_process_inherit (socket x, bool new_value)
 Sets x to be inherited by child processes if new_value == true or not if new_value == false.
 
error CAF_NET_EXPORT nonblocking (socket x, bool new_value)
 Enables or disables nonblocking I/O on x.
 
error CAF_NET_EXPORT shutdown_read (socket x)
 Disallows further reads from the socket.
 
error CAF_NET_EXPORT shutdown_write (socket x)
 Disallows further writes to the socket.
 

Detailed Description

An internal endpoint for sending or receiving data.

Can be either a network_socket, pipe_socket, stream_socket, or datagram_socket.

Friends And Related Symbol Documentation

◆ child_process_inherit()

error CAF_NET_EXPORT child_process_inherit ( socket x,
bool new_value )
related

Sets x to be inherited by child processes if new_value == true or not if new_value == false.

Not implemented on Windows.

◆ last_socket_error_is_temporary()

bool CAF_NET_EXPORT last_socket_error_is_temporary ( )
related

Checks whether last_socket_error() would return an error code that indicates a temporary error.

Returns
true if last_socket_error() returned either std::errc::operation_would_block or std::errc::resource_unavailable_try_again, false otherwise.

◆ probe()

bool CAF_NET_EXPORT probe ( socket x)
related

Queries whether x is a valid and connected socket by reading the socket option SO_ERROR.

Sets the last socket error in case the socket entered an error state.

Returns
true if no error is pending on x, false otherwise.

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