67 lines
5.0 KiB
HTML
67 lines
5.0 KiB
HTML
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
<title>Pipes</title>
|
|
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
|
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
|
<link rel="home" href="../../index.html" title="Asio">
|
|
<link rel="up" href="../overview.html" title="Overview">
|
|
<link rel="prev" href="files.html" title="Files">
|
|
<link rel="next" href="serial_ports.html" title="Serial Ports">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
</head>
|
|
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
|
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
|
<hr>
|
|
<div class="spirit-nav">
|
|
<a accesskey="p" href="files.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../overview.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="serial_ports.html"><img src="../../next.png" alt="Next"></a>
|
|
</div>
|
|
<div class="section">
|
|
<div class="titlepage"><div><div><h3 class="title">
|
|
<a name="asio.overview.pipes"></a><a class="link" href="pipes.html" title="Pipes">Pipes</a>
|
|
</h3></div></div></div>
|
|
<p>
|
|
Asio provides support for portable anonymous pipes on POSIX and Windows (when
|
|
I/O completion ports are available). For example, to create and use a connected
|
|
pair of pipe objects:
|
|
</p>
|
|
<pre class="programlisting"><span class="identifier">asio</span><span class="special">::</span><span class="identifier">readable_pipe</span> <span class="identifier">read_end</span><span class="special">(</span><span class="identifier">my_io_context</span><span class="special">);</span>
|
|
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">writable_pipe</span> <span class="identifier">write_end</span><span class="special">(</span><span class="identifier">my_io_context</span><span class="special">);</span>
|
|
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">connect_pipe</span><span class="special">(</span><span class="identifier">read_end</span><span class="special">,</span> <span class="identifier">write_end</span><span class="special">);</span>
|
|
|
|
<span class="identifier">write_end</span><span class="special">.</span><span class="identifier">async_write_some</span><span class="special">(</span><span class="identifier">my_write_buffer</span><span class="special">,</span>
|
|
<span class="special">[](</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span> <span class="identifier">e</span><span class="special">,</span> <span class="identifier">size_t</span> <span class="identifier">n</span><span class="special">)</span>
|
|
<span class="special">{</span>
|
|
<span class="comment">// ...</span>
|
|
<span class="special">});</span>
|
|
|
|
<span class="identifier">read_end</span><span class="special">.</span><span class="identifier">async_read_some</span><span class="special">(</span><span class="identifier">my_read_buffer</span><span class="special">,</span>
|
|
<span class="special">[](</span><span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span> <span class="identifier">e</span><span class="special">,</span> <span class="identifier">size_t</span> <span class="identifier">n</span><span class="special">)</span>
|
|
<span class="special">{</span>
|
|
<span class="comment">// ...</span>
|
|
<span class="special">});</span>
|
|
</pre>
|
|
<h5>
|
|
<a name="asio.overview.pipes.h0"></a>
|
|
<span><a name="asio.overview.pipes.see_also"></a></span><a class="link" href="pipes.html#asio.overview.pipes.see_also">See
|
|
Also</a>
|
|
</h5>
|
|
<p>
|
|
<a class="link" href="../reference/basic_readable_pipe.html" title="basic_readable_pipe">basic_readable_pipe</a>,
|
|
<a class="link" href="../reference/basic_writable_pipe.html" title="basic_writable_pipe">basic_writable_pipe</a>,
|
|
<a class="link" href="../reference/connect_pipe.html" title="connect_pipe">connect_pipe</a>, <a class="link" href="../reference/readable_pipe.html" title="readable_pipe">readable_pipe</a>,
|
|
<a class="link" href="../reference/writable_pipe.html" title="writable_pipe">writable_pipe</a>.
|
|
</p>
|
|
</div>
|
|
<div class="copyright-footer">Copyright © 2003-2023 Christopher M. Kohlhoff<p>
|
|
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
|
</p>
|
|
</div>
|
|
<hr>
|
|
<div class="spirit-nav">
|
|
<a accesskey="p" href="files.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../overview.html"><img src="../../up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../home.png" alt="Home"></a><a accesskey="n" href="serial_ports.html"><img src="../../next.png" alt="Next"></a>
|
|
</div>
|
|
</body>
|
|
</html>
|