boost::corosio::local_stream_acceptor

An asynchronous Unix domain stream acceptor for coroutine I/O.

Synopsis

class local_stream_acceptor
    : public io_object

Description

This class provides asynchronous Unix domain stream accept operations that return awaitable types. The acceptor binds to a local endpoint (filesystem path or abstract name) and listens for incoming connections.

The library does NOT automatically unlink the socket path on close. Callers are responsible for removing the socket file before bind (via bind_option::unlink_existing) or after close.

Thread Safety

Distinct objects: Safe. Shared objects: Unsafe. An acceptor must not have concurrent accept operations.

Example

io_context ioc;
local_stream_acceptor acc(ioc);
acc.open();
acc.bind(local_endpoint("/tmp/my.sock"),
         bind_option::unlink_existing);
acc.listen();
auto [ec, peer] = co_await acc.accept();

Base Classes

Name Description

io_object

Base class for platform I/O objects.

Types

Name

Description

handle

RAII wrapper for I/O object implementation lifetime.

implementation

Backend hooks for local stream acceptor operations.

io_service

Service interface for I/O object lifecycle management.

Member Functions

Name

Description

local_stream_acceptor [constructor] [deleted]

Constructors

~local_stream_acceptor [destructor] [virtual]

Destructor.

operator= [deleted]

Move assignment operator.

accept

accept overloads

bind

Bind to a local endpoint.

cancel

Cancel pending asynchronous accept operations.

close

Close the acceptor.

context

Return the execution context.

get_option

Get a socket option from the acceptor.

is_open

Check if the acceptor has an open socket handle.

listen

Start listening for incoming connections.

local_endpoint

Return the local endpoint the acceptor is bound to.

open

Create the acceptor socket.

release

Release ownership of the native socket handle.

set_option

Set a socket option on the acceptor.

Protected Member Functions

Name

Description

local_stream_acceptor [constructor]

Constructors

operator= [deleted]

Move assign from another I/O object.

Protected Static Member Functions

Name

Description

create_handle

Create a handle bound to a service found in the context.

reset_peer_impl

Protected Data Members

Name

Description

h_

The platform I/O handle owned by this object.

Created with MrDocs