boost::corosio::native_local_stream_socket
An asynchronous Unix stream socket with devirtualized I/O operations.
Synopsis
Declared in <boost/corosio/native/native_local_stream_socket.hpp>
template<auto Backend>
class native_local_stream_socket
: public local_stream_socket
Description
This class template inherits from local_stream_socket and shadows the async operations (read_some, write_some, connect) with versions that call the backend implementation directly, allowing the compiler to inline through the entire call chain.
Non‐async operations (open, close, cancel, socket options) remain unchanged and dispatch through the compiled library.
A native_local_stream_socket IS‐A local_stream_socket and can be passed to any function expecting local_stream_socket& or io_stream&, in which case virtual dispatch is used transparently.
Thread Safety
Same as local_stream_socket.
Example
#include <boost/corosio/native/native_local_stream_socket.hpp>
native_io_context<epoll> ctx;
native_local_stream_socket<epoll> s(ctx);
s.open();
auto [ec] = co_await s.connect(local_endpoint("/tmp/my.sock"));
Types
Name |
Description |
Represent the awaitable returned by |
|
RAII wrapper for I/O object implementation lifetime. |
|
Define backend hooks for local stream socket operations. |
|
Service interface for I/O object lifecycle management. |
|
Represent the awaitable returned by |
Member Functions
Name |
Description |
|
Constructors |
|
Assignment operators |
Assign an existing file descriptor to this socket. |
|
Query the number of bytes available for reading. |
|
Cancel any pending asynchronous operations. |
|
Close the socket. |
|
Asynchronously connect to a remote endpoint. |
|
Return the execution context. |
|
Get a socket option. |
|
Check if the socket is open. |
|
Get the local endpoint of the socket. |
|
Get the native socket handle. |
|
Open the socket. |
|
Asynchronously read data from the socket. |
|
Release ownership of the native socket handle. |
|
Get the remote endpoint of the socket. |
|
Set a socket option. |
|
|
|
Asynchronously wait for the socket to be ready. |
|
Asynchronously write data to the socket. |
Protected Types
Name |
Description |
Awaitable for async read operations. |
|
Awaitable for async write operations. |
Protected Member Functions
Name |
Description |
|
Move assign from another I/O object. |
|
|
|
|
Protected Static Member Functions
Name |
Description |
Create a handle bound to a service found in the context. |
Non-Member Functions
Name |
Description |
Synchronously connect two AF_UNIX stream sockets as a connected pair. |
Template Parameters
Name |
Description |
Backend |
A backend tag value (e.g., |
See Also
local_stream_socket, epoll_t, iocp_t
Created with MrDocs