asio C++ library

PrevUpHomeNext

local::stream_protocol::acceptor

The UNIX domain acceptor type.

typedef basic_socket_acceptor< stream_protocol > acceptor;
Types

Name

Description

rebind_executor

Rebinds the acceptor type to another executor.

broadcast

Socket option to permit sending of broadcast messages.

bytes_readable

IO control command to get the amount of data that can be read without blocking.

debug

Socket option to enable socket-level debugging.

do_not_route

Socket option to prevent routing, use local interfaces only.

enable_connection_aborted

Socket option to report aborted connections on accept.

endpoint_type

The endpoint type.

executor_type

The type of the executor associated with the object.

keep_alive

Socket option to send keep-alives.

linger

Socket option to specify whether the socket lingers on close if unsent data is present.

message_flags

Bitmask type for flags that can be passed to send and receive operations.

native_handle_type

The native representation of an acceptor.

out_of_band_inline

Socket option for putting received out-of-band data inline.

protocol_type

The protocol type.

receive_buffer_size

Socket option for the receive buffer size of a socket.

receive_low_watermark

Socket option for the receive low watermark.

reuse_address

Socket option to allow the socket to be bound to an address that is already in use.

send_buffer_size

Socket option for the send buffer size of a socket.

send_low_watermark

Socket option for the send low watermark.

shutdown_type

Different ways a socket may be shutdown.

wait_type

Wait types.

Member Functions

Name

Description

accept

Accept a new connection.

Accept a new connection and obtain the endpoint of the peer.

assign

Assigns an existing native acceptor to the acceptor.

async_accept

Start an asynchronous accept.

async_wait

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.

Construct an open acceptor.

Construct an acceptor opened on the given endpoint.

Construct a basic_socket_acceptor on an existing native acceptor.

Move-construct a basic_socket_acceptor from another.

Move-construct a basic_socket_acceptor from an acceptor of another protocol type.

bind

Bind the acceptor to the given local endpoint.

cancel

Cancel all asynchronous operations associated with the acceptor.

close

Close the acceptor.

get_executor

Get the executor associated with the object.

get_option

Get an option from the acceptor.

io_control

Perform an IO control command on the acceptor.

is_open

Determine whether the acceptor is open.

listen

Place the acceptor into the state where it will listen for new connections.

local_endpoint

Get the local endpoint of the acceptor.

native_handle

Get the native acceptor representation.

native_non_blocking

Gets the non-blocking mode of the native acceptor implementation.

Sets the non-blocking mode of the native acceptor implementation.

non_blocking

Gets the non-blocking mode of the acceptor.

Sets the non-blocking mode of the acceptor.

open

Open the acceptor using the specified protocol.

operator=

Move-assign a basic_socket_acceptor from another.

Move-assign a basic_socket_acceptor from an acceptor of another protocol type.

release

Release ownership of the underlying native acceptor.

set_option

Set an option on the acceptor.

wait

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.

Data Members

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.

Thread Safety

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.

Example

Opening a socket acceptor with the SO_REUSEADDR option enabled:

asio::ip::tcp::acceptor acceptor(my_context);
asio::ip::tcp::endpoint endpoint(asio::ip::tcp::v4(), port);
acceptor.open(endpoint.protocol());
acceptor.set_option(asio::ip::tcp::acceptor::reuse_address(true));
acceptor.bind(endpoint);
acceptor.listen();
Requirements

Header: asio/local/stream_protocol.hpp

Convenience header: asio.hpp


PrevUpHomeNext