...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Provides the ability to accept new connections.
template< typename Protocol, typename Executor> class basic_socket_acceptor : public socket_base
Name |
Description |
---|---|
Rebinds the acceptor type to another executor. |
|
Socket option to permit sending of broadcast messages. |
|
IO control command to get the amount of data that can be read without blocking. |
|
Socket option to enable socket-level debugging. |
|
Socket option to prevent routing, use local interfaces only. |
|
Socket option to report aborted connections on accept. |
|
The endpoint type. |
|
The type of the executor associated with the object. |
|
Socket option to send keep-alives. |
|
Socket option to specify whether the socket lingers on close if unsent data is present. |
|
Bitmask type for flags that can be passed to send and receive operations. |
|
The native representation of an acceptor. |
|
Socket option for putting received out-of-band data inline. |
|
The protocol type. |
|
Socket option for the receive buffer size of a socket. |
|
Socket option for the receive low watermark. |
|
Socket option to allow the socket to be bound to an address that is already in use. |
|
Socket option for the send buffer size of a socket. |
|
Socket option for the send low watermark. |
|
Different ways a socket may be shutdown. |
|
Wait types. |
Name |
Description |
---|---|
Accept a new connection. |
|
Assigns an existing native acceptor to the acceptor. |
|
Start an asynchronous accept. |
|
Asynchronously wait for the acceptor to become ready to read, ready to write, or to have pending error conditions. |
|
basic_socket_acceptor [constructor] |
Construct an acceptor without opening it. |
Bind the acceptor to the given local endpoint. |
|
Cancel all asynchronous operations associated with the acceptor. |
|
Close the acceptor. |
|
Get the executor associated with the object. |
|
Get an option from the acceptor. |
|
Perform an IO control command on the acceptor. |
|
Determine whether the acceptor is open. |
|
Place the acceptor into the state where it will listen for new connections. |
|
Get the local endpoint of the acceptor. |
|
Get the native acceptor representation. |
|
Gets the non-blocking mode of the native acceptor implementation.
|
|
Gets the non-blocking mode of the acceptor. |
|
Open the acceptor using the specified protocol. |
|
Move-assign a basic_socket_acceptor from another. |
|
Release ownership of the underlying native acceptor. |
|
Set an option on the acceptor. |
|
Wait for the acceptor to become ready to read, ready to write, or to have pending error conditions. |
|
~basic_socket_acceptor [destructor] |
Destroys the acceptor. |
Name |
Description |
---|---|
max_connections [static] |
(Deprecated: Use max_listen_connections.) The maximum length of the queue of pending incoming connections. |
max_listen_connections [static] |
The maximum length of the queue of pending incoming connections. |
message_do_not_route [static] |
Specify that the data should not be subject to routing. |
message_end_of_record [static] |
Specifies that the data marks the end of a record. |
message_out_of_band [static] |
Process out-of-band data. |
message_peek [static] |
Peek at incoming data without removing it from the input queue. |
The basic_socket_acceptor
class template
is used for accepting new socket connections.
Distinct objects: Safe.
Shared objects: Unsafe.
Synchronous accept
operations
are thread safe, if the underlying operating system calls are also thread
safe. This means that it is permitted to perform concurrent calls to synchronous
accept
operations on a single
socket object. Other synchronous operations, such as open
or close
, are not thread
safe.
Opening a socket acceptor with the SO_REUSEADDR option enabled:
boost::asio::ip::tcp::acceptor acceptor(my_context); boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), port); acceptor.open(endpoint.protocol()); acceptor.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true)); acceptor.bind(endpoint); acceptor.listen();
Header: boost/asio/basic_socket_acceptor.hpp
Convenience header: boost/asio.hpp