Clementine
Public Types | Public Member Functions | Protected Member Functions | List of all members
asio::basic_socket_streambuf< Protocol, Clock, WaitTraits > Class Template Reference

Iostream streambuf for a socket. More...

#include <basic_socket_streambuf.hpp>

Inheritance diagram for asio::basic_socket_streambuf< Protocol, Clock, WaitTraits >:
Inheritance graph
[legend]
Collaboration diagram for asio::basic_socket_streambuf< Protocol, Clock, WaitTraits >:
Collaboration graph
[legend]

Public Types

typedef Protocol protocol_type
 The protocol type.
 
typedef Protocol::endpoint endpoint_type
 The endpoint type.
 
typedef Clock clock_type
 The clock type.
 
typedef traits_helper::time_type time_type
 
typedef traits_helper::duration_type duration_type
 
typedef traits_helper::time_type time_point
 
typedef traits_helper::duration_type duration
 
- Public Types inherited from asio::basic_socket< Protocol >
typedef Executor executor_type
 The type of the executor associated with the object.
 
typedef detail::reactive_socket_service< Protocol >::native_handle_type native_handle_type
 The native representation of a socket.
 
typedef Protocol protocol_type
 The protocol type.
 
typedef Protocol::endpoint endpoint_type
 The endpoint type.
 
typedef basic_socket< Protocol, Executor > lowest_layer_type
 A basic_socket is always the lowest layer.
 
- Public Types inherited from asio::socket_base
enum  shutdown_type { shutdown_receive = ASIO_OS_DEF(SHUT_RD), shutdown_send = ASIO_OS_DEF(SHUT_WR), shutdown_both = ASIO_OS_DEF(SHUT_RDWR) }
 Different ways a socket may be shutdown.
 
enum  wait_type { wait_read, wait_write, wait_error }
 Wait types. More...
 
typedef int message_flags
 Bitmask type for flags that can be passed to send and receive operations.
 
typedef asio::detail::socket_option::boolean< ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_BROADCAST)> broadcast
 Socket option to permit sending of broadcast messages. More...
 
typedef asio::detail::socket_option::boolean< ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_DEBUG)> debug
 Socket option to enable socket-level debugging. More...
 
typedef asio::detail::socket_option::boolean< ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_DONTROUTE)> do_not_route
 Socket option to prevent routing, use local interfaces only. More...
 
typedef asio::detail::socket_option::boolean< ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_KEEPALIVE)> keep_alive
 Socket option to send keep-alives. More...
 
typedef asio::detail::socket_option::integer< ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_SNDBUF)> send_buffer_size
 Socket option for the send buffer size of a socket. More...
 
typedef asio::detail::socket_option::integer< ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_SNDLOWAT)> send_low_watermark
 Socket option for the send low watermark. More...
 
typedef asio::detail::socket_option::integer< ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_RCVBUF)> receive_buffer_size
 Socket option for the receive buffer size of a socket. More...
 
typedef asio::detail::socket_option::integer< ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_RCVLOWAT)> receive_low_watermark
 Socket option for the receive low watermark. More...
 
typedef asio::detail::socket_option::boolean< ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_REUSEADDR)> reuse_address
 Socket option to allow the socket to be bound to an address that is already in use. More...
 
typedef asio::detail::socket_option::linger< ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_LINGER)> linger
 Socket option to specify whether the socket lingers on close if unsent data is present. More...
 
typedef asio::detail::socket_option::boolean< ASIO_OS_DEF(SOL_SOCKET), ASIO_OS_DEF(SO_OOBINLINE)> out_of_band_inline
 Socket option for putting received out-of-band data inline. More...
 
typedef asio::detail::socket_option::boolean< asio::detail::custom_socket_option_level, asio::detail::enable_connection_aborted_option > enable_connection_aborted
 Socket option to report aborted connections on accept. More...
 
typedef asio::detail::io_control::bytes_readable bytes_readable
 IO control command to get the amount of data that can be read without blocking. More...
 

Public Member Functions

 basic_socket_streambuf ()
 Construct a basic_socket_streambuf without establishing a connection.
 
virtual ~basic_socket_streambuf ()
 Destructor flushes buffered data.
 
basic_socket_streambufconnect (const endpoint_type &endpoint)
 Establish a connection. More...
 
basic_socket_streambufclose ()
 Close the connection. More...
 
basic_socket< Protocol > & socket ()
 Get a reference to the underlying socket.
 
const asio::error_codeerror () const
 Get the last error associated with the stream buffer. More...
 
const asio::error_codepuberror () const
 (Deprecated: Use error().) Get the last error associated with the stream buffer. More...
 
time_point expires_at () const
 (Deprecated: Use expiry().) Get the stream buffer's expiry time as an absolute time. More...
 
time_point expiry () const
 Get the stream buffer's expiry time as an absolute time. More...
 
void expires_at (const time_point &expiry_time)
 Set the stream buffer's expiry time as an absolute time. More...
 
void expires_after (const duration &expiry_time)
 Set the stream buffer's expiry time relative to now. More...
 
duration expires_from_now () const
 (Deprecated: Use expiry().) Get the stream buffer's expiry time relative to now. More...
 
void expires_from_now (const duration &expiry_time)
 (Deprecated: Use expires_after().) Set the stream buffer's expiry time relative to now. More...
 
- Public Member Functions inherited from asio::basic_socket< Protocol >
 basic_socket (const executor_type &ex)
 Construct a basic_socket without opening it. More...
 
 basic_socket (ExecutionContext &context, typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *=0)
 Construct a basic_socket without opening it. More...
 
 basic_socket (const executor_type &ex, const protocol_type &protocol)
 Construct and open a basic_socket. More...
 
 basic_socket (ExecutionContext &context, const protocol_type &protocol, typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *=0)
 Construct and open a basic_socket. More...
 
 basic_socket (const executor_type &ex, const endpoint_type &endpoint)
 Construct a basic_socket, opening it and binding it to the given local endpoint. More...
 
 basic_socket (ExecutionContext &context, const endpoint_type &endpoint, typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *=0)
 Construct a basic_socket, opening it and binding it to the given local endpoint. More...
 
 basic_socket (const executor_type &ex, const protocol_type &protocol, const native_handle_type &native_socket)
 Construct a basic_socket on an existing native socket. More...
 
 basic_socket (ExecutionContext &context, const protocol_type &protocol, const native_handle_type &native_socket, typename enable_if< is_convertible< ExecutionContext &, execution_context & >::value >::type *=0)
 Construct a basic_socket on an existing native socket. More...
 
executor_type get_executor () ASIO_NOEXCEPT
 Get the executor associated with the object.
 
lowest_layer_typelowest_layer ()
 Get a reference to the lowest layer. More...
 
const lowest_layer_typelowest_layer () const
 Get a const reference to the lowest layer. More...
 
void open (const protocol_type &protocol=protocol_type())
 Open the socket using the specified protocol. More...
 
ASIO_SYNC_OP_VOID open (const protocol_type &protocol, asio::error_code &ec)
 Open the socket using the specified protocol. More...
 
void assign (const protocol_type &protocol, const native_handle_type &native_socket)
 Assign an existing native socket to the socket.
 
ASIO_SYNC_OP_VOID assign (const protocol_type &protocol, const native_handle_type &native_socket, asio::error_code &ec)
 Assign an existing native socket to the socket.
 
bool is_open () const
 Determine whether the socket is open.
 
void close ()
 Close the socket. More...
 
ASIO_SYNC_OP_VOID close (asio::error_code &ec)
 Close the socket. More...
 
native_handle_type release ()
 Release ownership of the underlying native socket. More...
 
native_handle_type release (asio::error_code &ec)
 Release ownership of the underlying native socket. More...
 
native_handle_type native_handle ()
 Get the native socket representation. More...
 
void cancel ()
 Cancel all asynchronous operations associated with the socket. More...
 
ASIO_SYNC_OP_VOID cancel (asio::error_code &ec)
 Cancel all asynchronous operations associated with the socket. More...
 
bool at_mark () const
 Determine whether the socket is at the out-of-band data mark. More...
 
bool at_mark (asio::error_code &ec) const
 Determine whether the socket is at the out-of-band data mark. More...
 
std::size_t available () const
 Determine the number of bytes available for reading. More...
 
std::size_t available (asio::error_code &ec) const
 Determine the number of bytes available for reading. More...
 
void bind (const endpoint_type &endpoint)
 Bind the socket to the given local endpoint. More...
 
ASIO_SYNC_OP_VOID bind (const endpoint_type &endpoint, asio::error_code &ec)
 Bind the socket to the given local endpoint. More...
 
void connect (const endpoint_type &peer_endpoint)
 Connect the socket to the specified endpoint. More...
 
ASIO_SYNC_OP_VOID connect (const endpoint_type &peer_endpoint, asio::error_code &ec)
 Connect the socket to the specified endpoint. More...
 
 ASIO_INITFN_AUTO_RESULT_TYPE (ConnectHandler, void(asio::error_code)) async_connect(const endpoint_type &peer_endpoint
 Start an asynchronous connect. More...
 
 ASIO_INITFN_AUTO_RESULT_TYPE (WaitHandler, void(asio::error_code)) async_wait(wait_type w
 Asynchronously wait for the socket to become ready to read, ready to write, or to have pending error conditions. More...
 
 ASIO_MOVE_ARG (ConnectHandler) handler ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
 
 ASIO_MOVE_ARG (WaitHandler) handler ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
 
void set_option (const SettableSocketOption &option)
 Set an option on the socket. More...
 
ASIO_SYNC_OP_VOID set_option (const SettableSocketOption &option, asio::error_code &ec)
 Set an option on the socket. More...
 
void get_option (GettableSocketOption &option) const
 Get an option from the socket. More...
 
ASIO_SYNC_OP_VOID get_option (GettableSocketOption &option, asio::error_code &ec) const
 Get an option from the socket. More...
 
void io_control (IoControlCommand &command)
 Perform an IO control command on the socket. More...
 
ASIO_SYNC_OP_VOID io_control (IoControlCommand &command, asio::error_code &ec)
 Perform an IO control command on the socket. More...
 
bool non_blocking () const
 Gets the non-blocking mode of the socket. More...
 
void non_blocking (bool mode)
 Sets the non-blocking mode of the socket. More...
 
ASIO_SYNC_OP_VOID non_blocking (bool mode, asio::error_code &ec)
 Sets the non-blocking mode of the socket. More...
 
bool native_non_blocking () const
 Gets the non-blocking mode of the native socket implementation. More...
 
void native_non_blocking (bool mode)
 Sets the non-blocking mode of the native socket implementation. More...
 
ASIO_SYNC_OP_VOID native_non_blocking (bool mode, asio::error_code &ec)
 Sets the non-blocking mode of the native socket implementation. More...
 
endpoint_type local_endpoint () const
 Get the local endpoint of the socket. More...
 
endpoint_type local_endpoint (asio::error_code &ec) const
 Get the local endpoint of the socket. More...
 
endpoint_type remote_endpoint () const
 Get the remote endpoint of the socket. More...
 
endpoint_type remote_endpoint (asio::error_code &ec) const
 Get the remote endpoint of the socket. More...
 
void shutdown (shutdown_type what)
 Disable sends or receives on the socket. More...
 
ASIO_SYNC_OP_VOID shutdown (shutdown_type what, asio::error_code &ec)
 Disable sends or receives on the socket. More...
 
void wait (wait_type w)
 Wait for the socket to become ready to read, ready to write, or to have pending error conditions. More...
 
ASIO_SYNC_OP_VOID wait (wait_type w, asio::error_code &ec)
 Wait for the socket to become ready to read, ready to write, or to have pending error conditions. More...
 
- Public Member Functions inherited from asio::socket_base
 ASIO_STATIC_CONSTANT (int, message_peek=ASIO_OS_DEF(MSG_PEEK))
 
 ASIO_STATIC_CONSTANT (int, message_out_of_band=ASIO_OS_DEF(MSG_OOB))
 
 ASIO_STATIC_CONSTANT (int, message_do_not_route=ASIO_OS_DEF(MSG_DONTROUTE))
 
 ASIO_STATIC_CONSTANT (int, message_end_of_record=ASIO_OS_DEF(MSG_EOR))
 
 ASIO_STATIC_CONSTANT (int, max_listen_connections=ASIO_OS_DEF(SOMAXCONN))
 The maximum length of the queue of pending incoming connections.
 
 ASIO_STATIC_CONSTANT (int, max_connections=ASIO_OS_DEF(SOMAXCONN))
 (Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. More...
 

Protected Member Functions

int_type underflow ()
 
int_type overflow (int_type c)
 
int sync ()
 
std::streambuf * setbuf (char_type *s, std::streamsize n)
 
- Protected Member Functions inherited from asio::basic_socket< Protocol >
 ~basic_socket ()
 Protected destructor to prevent deletion through this type. More...
 
- Protected Member Functions inherited from asio::socket_base
 ~socket_base ()
 Protected destructor to prevent deletion through this type.
 

Additional Inherited Members

- Protected Attributes inherited from asio::basic_socket< Protocol >
detail::io_object_impl< detail::reactive_socket_service< Protocol >, Executor > impl_
 

Detailed Description

template<typename Protocol, typename Clock, typename WaitTraits>
class asio::basic_socket_streambuf< Protocol, Clock, WaitTraits >

Iostream streambuf for a socket.

Member Function Documentation

◆ close()

template<typename Protocol, typename Clock, typename WaitTraits>
basic_socket_streambuf* asio::basic_socket_streambuf< Protocol, Clock, WaitTraits >::close ( )
inline

Close the connection.

Returns
this if a connection was successfully established, a null pointer otherwise.

◆ connect()

template<typename Protocol, typename Clock, typename WaitTraits>
basic_socket_streambuf* asio::basic_socket_streambuf< Protocol, Clock, WaitTraits >::connect ( const endpoint_type endpoint)
inline

Establish a connection.

This function establishes a connection to the specified endpoint.

Returns
this if a connection was successfully established, a null pointer otherwise.

◆ error()

template<typename Protocol, typename Clock, typename WaitTraits>
const asio::error_code& asio::basic_socket_streambuf< Protocol, Clock, WaitTraits >::error ( ) const
inline

Get the last error associated with the stream buffer.

Returns
An error_code corresponding to the last error from the stream buffer.

◆ expires_after()

template<typename Protocol, typename Clock, typename WaitTraits>
void asio::basic_socket_streambuf< Protocol, Clock, WaitTraits >::expires_after ( const duration &  expiry_time)
inline

Set the stream buffer's expiry time relative to now.

This function sets the expiry time associated with the stream. Stream operations performed after this time (where the operations cannot be completed using the internal buffers) will fail with the error asio::error::operation_aborted.

Parameters
expiry_timeThe expiry time to be used for the timer.

◆ expires_at() [1/2]

template<typename Protocol, typename Clock, typename WaitTraits>
time_point asio::basic_socket_streambuf< Protocol, Clock, WaitTraits >::expires_at ( ) const
inline

(Deprecated: Use expiry().) Get the stream buffer's expiry time as an absolute time.

Returns
An absolute time value representing the stream buffer's expiry time.

◆ expires_at() [2/2]

template<typename Protocol, typename Clock, typename WaitTraits>
void asio::basic_socket_streambuf< Protocol, Clock, WaitTraits >::expires_at ( const time_point &  expiry_time)
inline

Set the stream buffer's expiry time as an absolute time.

This function sets the expiry time associated with the stream. Stream operations performed after this time (where the operations cannot be completed using the internal buffers) will fail with the error asio::error::operation_aborted.

Parameters
expiry_timeThe expiry time to be used for the stream.

◆ expires_from_now() [1/2]

template<typename Protocol, typename Clock, typename WaitTraits>
duration asio::basic_socket_streambuf< Protocol, Clock, WaitTraits >::expires_from_now ( ) const
inline

(Deprecated: Use expiry().) Get the stream buffer's expiry time relative to now.

Returns
A relative time value representing the stream buffer's expiry time.

◆ expires_from_now() [2/2]

template<typename Protocol, typename Clock, typename WaitTraits>
void asio::basic_socket_streambuf< Protocol, Clock, WaitTraits >::expires_from_now ( const duration &  expiry_time)
inline

(Deprecated: Use expires_after().) Set the stream buffer's expiry time relative to now.

This function sets the expiry time associated with the stream. Stream operations performed after this time (where the operations cannot be completed using the internal buffers) will fail with the error asio::error::operation_aborted.

Parameters
expiry_timeThe expiry time to be used for the timer.

◆ expiry()

template<typename Protocol, typename Clock, typename WaitTraits>
time_point asio::basic_socket_streambuf< Protocol, Clock, WaitTraits >::expiry ( ) const
inline

Get the stream buffer's expiry time as an absolute time.

Returns
An absolute time value representing the stream buffer's expiry time.

◆ puberror()

template<typename Protocol, typename Clock, typename WaitTraits>
const asio::error_code& asio::basic_socket_streambuf< Protocol, Clock, WaitTraits >::puberror ( ) const
inline

(Deprecated: Use error().) Get the last error associated with the stream buffer.

Returns
An error_code corresponding to the last error from the stream buffer.

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