AsyncReadStream.html 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
  4. <title>Buffer-oriented asynchronous read stream requirements</title>
  5. <link rel="stylesheet" href="../../boostbook.css" type="text/css">
  6. <meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
  7. <link rel="home" href="../../index.html" title="Asio">
  8. <link rel="up" href="../reference.html" title="Reference">
  9. <link rel="prev" href="AsyncRandomAccessWriteDevice.html" title="Buffer-oriented asynchronous random-access write device requirements">
  10. <link rel="next" href="AsyncWriteStream.html" title="Buffer-oriented asynchronous write stream requirements">
  11. </head>
  12. <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
  13. <table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
  14. <hr>
  15. <div class="spirit-nav">
  16. <a accesskey="p" href="AsyncRandomAccessWriteDevice.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.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="AsyncWriteStream.html"><img src="../../next.png" alt="Next"></a>
  17. </div>
  18. <div class="section">
  19. <div class="titlepage"><div><div><h3 class="title">
  20. <a name="asio.reference.AsyncReadStream"></a><a class="link" href="AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">Buffer-oriented asynchronous
  21. read stream requirements</a>
  22. </h3></div></div></div>
  23. <p>
  24. In the table below, <code class="computeroutput"><span class="identifier">a</span></code> denotes
  25. an asynchronous read stream object, <code class="computeroutput"><span class="identifier">mb</span></code>
  26. denotes an object satisfying <a class="link" href="MutableBufferSequence.html" title="Mutable buffer sequence requirements">mutable
  27. buffer sequence</a> requirements, and <code class="computeroutput"><span class="identifier">h</span></code>
  28. denotes an object satisfying <a class="link" href="ReadHandler.html" title="Read handler requirements">read
  29. handler</a> requirements.
  30. </p>
  31. <div class="table">
  32. <a name="asio.reference.AsyncReadStream.t0"></a><p class="title"><b>Table&#160;3.&#160;Buffer-oriented asynchronous read stream requirements</b></p>
  33. <div class="table-contents"><table class="table" summary="Buffer-oriented asynchronous read stream requirements">
  34. <colgroup>
  35. <col>
  36. <col>
  37. <col>
  38. </colgroup>
  39. <thead><tr>
  40. <th>
  41. <p>
  42. operation
  43. </p>
  44. </th>
  45. <th>
  46. <p>
  47. type
  48. </p>
  49. </th>
  50. <th>
  51. <p>
  52. semantics, pre/post-conditions
  53. </p>
  54. </th>
  55. </tr></thead>
  56. <tbody>
  57. <tr>
  58. <td>
  59. <p>
  60. <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">get_io_service</span><span class="special">();</span></code>
  61. </p>
  62. </td>
  63. <td>
  64. <p>
  65. <code class="computeroutput"><span class="identifier">io_service</span><span class="special">&amp;</span></code>
  66. </p>
  67. </td>
  68. <td>
  69. <p>
  70. Returns the <code class="computeroutput"><span class="identifier">io_service</span></code>
  71. object through which the <code class="computeroutput"><span class="identifier">async_read_some</span></code>
  72. handler <code class="computeroutput"><span class="identifier">h</span></code> will
  73. be invoked.
  74. </p>
  75. </td>
  76. </tr>
  77. <tr>
  78. <td>
  79. <p>
  80. <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">async_read_some</span><span class="special">(</span><span class="identifier">mb</span><span class="special">,</span>
  81. <span class="identifier">h</span><span class="special">);</span></code>
  82. </p>
  83. </td>
  84. <td>
  85. <p>
  86. <code class="computeroutput"><span class="keyword">void</span></code>
  87. </p>
  88. </td>
  89. <td>
  90. <p>
  91. Initiates an asynchronous operation to read one or more bytes of
  92. data from the stream <code class="computeroutput"><span class="identifier">a</span></code>.
  93. The operation is performed via the <code class="computeroutput"><span class="identifier">io_service</span></code>
  94. object <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">get_io_service</span><span class="special">()</span></code>
  95. and behaves according to <a class="link" href="asynchronous_operations.html" title="Requirements on asynchronous operations">asynchronous
  96. operation</a> requirements.<br> <br> The mutable buffer
  97. sequence <code class="computeroutput"><span class="identifier">mb</span></code> specifies
  98. memory where the data should be placed. The <code class="computeroutput"><span class="identifier">async_read_some</span></code>
  99. operation shall always fill a buffer in the sequence completely
  100. before proceeding to the next.<br> <br> The implementation
  101. shall maintain one or more copies of <code class="computeroutput"><span class="identifier">mb</span></code>
  102. until such time as the read operation no longer requires access
  103. to the memory specified by the buffers in the sequence. The program
  104. must ensure the memory is valid until:<br> <br> &#8212; the last copy
  105. of <code class="computeroutput"><span class="identifier">mb</span></code> is destroyed,
  106. or<br> <br> &#8212; the handler for the asynchronous read operation
  107. is invoked,<br> <br> whichever comes first.<br> <br> If
  108. the total size of all buffers in the sequence <code class="computeroutput"><span class="identifier">mb</span></code>
  109. is <code class="computeroutput"><span class="number">0</span></code>, the asynchronous
  110. read operation shall complete immediately and pass <code class="computeroutput"><span class="number">0</span></code> as the argument to the handler
  111. that specifies the number of bytes read.
  112. </p>
  113. </td>
  114. </tr>
  115. </tbody>
  116. </table></div>
  117. </div>
  118. <br class="table-break">
  119. </div>
  120. <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
  121. <td align="left"></td>
  122. <td align="right"><div class="copyright-footer">Copyright &#169; 2003-2014 Christopher M. Kohlhoff<p>
  123. Distributed under the Boost Software License, Version 1.0. (See accompanying
  124. 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>)
  125. </p>
  126. </div></td>
  127. </tr></table>
  128. <hr>
  129. <div class="spirit-nav">
  130. <a accesskey="p" href="AsyncRandomAccessWriteDevice.html"><img src="../../prev.png" alt="Prev"></a><a accesskey="u" href="../reference.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="AsyncWriteStream.html"><img src="../../next.png" alt="Next"></a>
  131. </div>
  132. </body>
  133. </html>