boost::corosio::native_local_datagram_socket
An asynchronous Unix datagram socket with devirtualized I/O.
Synopsis
Declared in <boost/corosio/native/native_local_datagram_socket.hpp>
template<auto Backend>
class native_local_datagram_socket
: public local_datagram_socket
Description
This class template inherits from local_datagram_socket and shadows the async operations (send_to, recv_from, connect, send, recv) with versions that call the backend implementation directly, allowing the compiler to inline through the entire call chain.
Non‐async operations (open, close, cancel, bind, socket options) remain unchanged and dispatch through the compiled library.
A native_local_datagram_socket IS‐A local_datagram_socket and can be passed to any function expecting local_datagram_socket&, in which case virtual dispatch is used transparently.
Thread Safety
Same as local_datagram_socket.
Example
#include <boost/corosio/native/native_local_datagram_socket.hpp>
native_io_context<epoll> ctx;
native_local_datagram_socket<epoll> s(ctx);
s.open();
s.bind(local_endpoint("/tmp/recv.sock"));
char buf[1024];
local_endpoint sender;
auto [ec, n] = co_await s.recv_from(
capy::mutable_buffer(buf, sizeof(buf)), sender);
Types
Name |
Description |
Represent the awaitable returned by |
|
RAII wrapper for I/O object implementation lifetime. |
|
Define backend hooks for local datagram socket operations. |
|
Service interface for I/O object lifecycle management. |
|
Represent the awaitable returned by |
|
Represent the awaitable returned by |
|
Represent the awaitable returned by |
|
Represent the awaitable returned by |
|
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. |
|
Bind the socket to a local endpoint. |
|
Cancel any pending asynchronous operations. |
|
Close the socket. |
|
Asynchronously connect to set the default peer. |
|
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. |
|
Receive a datagram from the connected peer. |
|
Receive a datagram and capture the sender's endpoint. |
|
Release ownership of the native socket handle. |
|
Get the remote endpoint of the socket. |
|
Send a datagram to the connected peer. |
|
Send a datagram to the specified destination. |
|
Set a socket option. |
|
|
|
Asynchronously wait for the socket to be ready. |
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 datagram sockets as a connected pair. |
Template Parameters
Name |
Description |
Backend |
A backend tag value (e.g., |
See Also
local_datagram_socket, epoll_t, iocp_t
Created with MrDocs