Asio contains classes to allow asynchronous read and write operations to
be performed on Windows HANDLE
s, such as named pipes.
For example, to perform asynchronous operations on a named pipe, the following object may be created:
HANDLE handle = ::CreateFile(...); windows::stream_handle pipe(my_io_context, handle);
These are then used as synchronous or asynchronous read and write streams. This means the objects can be used with any of the read(), async_read(), write(), async_write(), read_until() or async_read_until() free functions.
The kernel object referred to by the HANDLE
must support use
with I/O completion ports (which means that named pipes are supported,
but anonymous pipes and console streams are not).
Windows stream HANDLE
s are only available at compile time
when targeting Windows and only when the I/O completion port backend is
used (which is the default). A program may test for the macro ASIO_HAS_WINDOWS_STREAM_HANDLE
to determine whether they are supported.