Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

Click here to view the latest version of this page.
PrevUpHomeNext

Stream-Oriented HANDLEs

Boost.Asio contains classes to allow asynchronous read and write operations to be performed on Windows HANDLEs, 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_service, 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).

See Also

windows::stream_handle, windows::basic_stream_handle, windows::stream_handle_service.

Notes

Windows stream HANDLEs 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 BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE to determine whether they are supported.


PrevUpHomeNext