boost::corosio::local_stream_acceptor
Accepts inbound Unix domain stream connections, from a coroutine.
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
capy::task<>
bind_listen_accept(corosio::io_context& ioc)
{
corosio::local_stream_acceptor acc(ioc);
if (auto ec = acc.open())
co_return;
if (auto ec = acc.bind(
corosio::local_endpoint("/tmp/my_app.sock"),
corosio::bind_option::unlink_existing))
co_return;
if (auto ec = acc.listen())
co_return;
auto [aec, peer] = co_await acc.accept();
if (aec)
co_return;
}
Base Classes
Name |
Description |
Owns the platform‐specific handle and execution context that a derived socket, timer, signal handler, or acceptor type uses to dispatch operations. |
Types
Name |
Description |
Owns a platform‐specific I/O implementation and destroys it when the handle goes out of scope. |
|
Backends derive from this to implement accept, option, and lifecycle management. |
|
Constructs, closes, and destroys platform implementations on behalf of an I/O object. Platform backends implement this interface. |
Member Functions
Name |
Description |
|
Constructors |
|
Closes the acceptor if open, cancelling any pending operations. |
Assignment operators |
|
|
|
Assign an existing native socket to this acceptor. |
|
Bind to a local endpoint. |
|
Cancel pending asynchronous accept operations. |
|
Close the acceptor. |
|
Return the execution context. |
|
Get a socket option from the acceptor. |
|
Check if the acceptor has an open socket handle. |
|
Start listening for incoming connections. |
|
Return the local endpoint the acceptor is bound to. |
|
Get the native socket handle. |
|
Create the acceptor socket. |
|
Release ownership of the native socket handle. |
|
Set a socket option on the acceptor. |
|
Wait for an incoming connection or readiness condition. |
Protected Member Functions
Name |
Description |
|
Constructors |
Assignment operators |
Protected Static Member Functions
Name |
Description |
Create a handle bound to a service found in the context. |
|
Install an accepted implementation into the peer socket. |
Derived Classes
Name |
Description |
Accepts Unix domain stream connections, calling the backend directly. |
Created with MrDocs