change support python version
[platform/upstream/boost.git] / doc / html / boost_asio / overview / posix / stream_descriptor.html
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>Stream-Oriented File Descriptors</title>
5 <link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
6 <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7 <link rel="home" href="../../../boost_asio.html" title="Boost.Asio">
8 <link rel="up" href="../posix.html" title="POSIX-Specific Functionality">
9 <link rel="prev" href="local.html" title="UNIX Domain Sockets">
10 <link rel="next" href="fork.html" title="Fork">
11 </head>
12 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13 <table cellpadding="2" width="100%"><tr>
14 <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
15 <td align="center"><a href="../../../../../index.html">Home</a></td>
16 <td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
17 <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18 <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19 <td align="center"><a href="../../../../../more/index.htm">More</a></td>
20 </tr></table>
21 <hr>
22 <div class="spirit-nav">
23 <a accesskey="p" href="local.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../posix.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../boost_asio.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="fork.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
24 </div>
25 <div class="section">
26 <div class="titlepage"><div><div><h4 class="title">
27 <a name="boost_asio.overview.posix.stream_descriptor"></a><a class="link" href="stream_descriptor.html" title="Stream-Oriented File Descriptors">Stream-Oriented
28         File Descriptors</a>
29 </h4></div></div></div>
30 <p>
31           Boost.Asio includes classes added to permit synchronous and asynchronous
32           read and write operations to be performed on POSIX file descriptors, such
33           as pipes, standard input and output, and various devices.
34         </p>
35 <p>
36           These classes also provide limited support for regular files. This support
37           assumes that the underlying read and write operations provided by the operating
38           system never fail with <code class="computeroutput">EAGAIN</code> or <code class="computeroutput">EWOULDBLOCK</code>.
39           (This assumption normally holds for buffered file I/O.) Synchronous and
40           asynchronous read and write operations on file descriptors will succeed
41           but the I/O will always be performed immediately. Wait operations, and
42           operations involving <code class="computeroutput">boost::asio::null_buffers</code>, are not portably
43           supported.
44         </p>
45 <p>
46           For example, to perform read and write operations on standard input and
47           output, the following objects may be created:
48         </p>
49 <pre class="programlisting">posix::stream_descriptor in(my_io_context, ::dup(STDIN_FILENO));
50 posix::stream_descriptor out(my_io_context, ::dup(STDOUT_FILENO));
51 </pre>
52 <p>
53           These are then used as synchronous or asynchronous read and write streams.
54           This means the objects can be used with any of the <a class="link" href="../../reference/read.html" title="read">read()</a>,
55           <a class="link" href="../../reference/async_read.html" title="async_read">async_read()</a>, <a class="link" href="../../reference/write.html" title="write">write()</a>, <a class="link" href="../../reference/async_write.html" title="async_write">async_write()</a>,
56           <a class="link" href="../../reference/read_until.html" title="read_until">read_until()</a> or
57           <a class="link" href="../../reference/async_read_until.html" title="async_read_until">async_read_until()</a>
58           free functions.
59         </p>
60 <h6>
61 <a name="boost_asio.overview.posix.stream_descriptor.h0"></a>
62           <span class="phrase"><a name="boost_asio.overview.posix.stream_descriptor.see_also"></a></span><a class="link" href="stream_descriptor.html#boost_asio.overview.posix.stream_descriptor.see_also">See Also</a>
63         </h6>
64 <p>
65           <a class="link" href="../../reference/posix__stream_descriptor.html" title="posix::stream_descriptor">posix::stream_descriptor</a>,
66           <a class="link" href="../../examples/cpp03_examples.html#boost_asio.examples.cpp03_examples.chat">Chat example (C++03)</a>,
67           <a class="link" href="../../examples/cpp11_examples.html#boost_asio.examples.cpp11_examples.chat">Chat example (C++11)</a>.
68         </p>
69 <h6>
70 <a name="boost_asio.overview.posix.stream_descriptor.h1"></a>
71           <span class="phrase"><a name="boost_asio.overview.posix.stream_descriptor.notes"></a></span><a class="link" href="stream_descriptor.html#boost_asio.overview.posix.stream_descriptor.notes">Notes</a>
72         </h6>
73 <p>
74           POSIX stream descriptors are only available at compile time if supported
75           by the target operating system. A program may test for the macro <code class="computeroutput">BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR</code>
76           to determine whether they are supported.
77         </p>
78 </div>
79 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
80 <td align="left"></td>
81 <td align="right"><div class="copyright-footer">Copyright &#169; 2003-2019 Christopher M. Kohlhoff<p>
82         Distributed under the Boost Software License, Version 1.0. (See accompanying
83         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>)
84       </p>
85 </div></td>
86 </tr></table>
87 <hr>
88 <div class="spirit-nav">
89 <a accesskey="p" href="local.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../posix.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../boost_asio.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="fork.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
90 </div>
91 </body>
92 </html>