SeqPacketSocketService.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
  4. <title>Sequenced packet socket service 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="ResolverService.html" title="Resolver service requirements">
  10. <link rel="next" href="SerialPortService.html" title="Serial port service 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="ResolverService.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="SerialPortService.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.SeqPacketSocketService"></a><a class="link" href="SeqPacketSocketService.html" title="Sequenced packet socket service requirements">Sequenced packet
  21. socket service requirements</a>
  22. </h3></div></div></div>
  23. <p>
  24. A sequenced packet socket service must meet the requirements for a <a class="link" href="SocketService.html" title="Socket service requirements">socket service</a>, as well as
  25. the additional requirements listed below.
  26. </p>
  27. <p>
  28. In the table below, <code class="computeroutput"><span class="identifier">X</span></code> denotes
  29. a stream socket service class, <code class="computeroutput"><span class="identifier">a</span></code>
  30. denotes a value of type <code class="computeroutput"><span class="identifier">X</span></code>,
  31. <code class="computeroutput"><span class="identifier">b</span></code> denotes a value of type
  32. <code class="computeroutput"><span class="identifier">X</span><span class="special">::</span><span class="identifier">implementation_type</span></code>, <code class="computeroutput"><span class="identifier">ec</span></code>
  33. denotes a value of type <code class="computeroutput"><span class="identifier">error_code</span></code>,
  34. <code class="computeroutput"><span class="identifier">f</span></code> denotes a value of type
  35. <code class="computeroutput"><span class="identifier">socket_base</span><span class="special">::</span><span class="identifier">message_flags</span></code>, <code class="computeroutput"><span class="identifier">g</span></code>
  36. denotes an lvalue of type <code class="computeroutput"><span class="identifier">socket_base</span><span class="special">::</span><span class="identifier">message_flags</span></code>,
  37. <code class="computeroutput"><span class="identifier">mb</span></code> denotes a value satisfying
  38. <a class="link" href="MutableBufferSequence.html" title="Mutable buffer sequence requirements">mutable buffer sequence</a>
  39. requirements, <code class="computeroutput"><span class="identifier">rh</span></code> denotes
  40. a value meeting <a class="link" href="ReadHandler.html" title="Read handler requirements"><code class="computeroutput"><span class="identifier">ReadHandler</span></code></a> requirements, <code class="computeroutput"><span class="identifier">cb</span></code> denotes a value satisfying <a class="link" href="ConstBufferSequence.html" title="Constant buffer sequence requirements">constant
  41. buffer sequence</a> requirements, and <code class="computeroutput"><span class="identifier">wh</span></code>
  42. denotes a value meeting <a class="link" href="WriteHandler.html" title="Write handler requirements"><code class="computeroutput"><span class="identifier">WriteHandler</span></code></a> requirements.
  43. </p>
  44. <div class="table">
  45. <a name="asio.reference.SeqPacketSocketService.t0"></a><p class="title"><b>Table&#160;24.&#160;StreamSocketService requirements</b></p>
  46. <div class="table-contents"><table class="table" summary="StreamSocketService requirements">
  47. <colgroup>
  48. <col>
  49. <col>
  50. <col>
  51. </colgroup>
  52. <thead><tr>
  53. <th>
  54. <p>
  55. expression
  56. </p>
  57. </th>
  58. <th>
  59. <p>
  60. return type
  61. </p>
  62. </th>
  63. <th>
  64. <p>
  65. assertion/note<br> pre/post-condition
  66. </p>
  67. </th>
  68. </tr></thead>
  69. <tbody>
  70. <tr>
  71. <td>
  72. <p>
  73. <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">receive</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
  74. <span class="identifier">mb</span><span class="special">,</span>
  75. <span class="identifier">f</span><span class="special">,</span>
  76. <span class="identifier">g</span><span class="special">,</span>
  77. <span class="identifier">ec</span><span class="special">);</span></code>
  78. </p>
  79. </td>
  80. <td>
  81. <p>
  82. <code class="computeroutput"><span class="identifier">size_t</span></code>
  83. </p>
  84. </td>
  85. <td>
  86. <p>
  87. pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br>
  88. <br> Reads one or more bytes of data from a connected socket
  89. <code class="computeroutput"><span class="identifier">b</span></code>.<br> <br>
  90. The mutable buffer sequence <code class="computeroutput"><span class="identifier">mb</span></code>
  91. specifies memory where the data should be placed. The operation
  92. shall always fill a buffer in the sequence completely before proceeding
  93. to the next.<br> <br> If successful, sets <code class="computeroutput"><span class="identifier">g</span></code>
  94. to the flags associated with the received data, and returns the
  95. number of bytes read. Otherwise, sets <code class="computeroutput"><span class="identifier">g</span></code>
  96. to <code class="computeroutput"><span class="number">0</span></code> and returns <code class="computeroutput"><span class="number">0</span></code>.
  97. </p>
  98. </td>
  99. </tr>
  100. <tr>
  101. <td>
  102. <p>
  103. <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">async_receive</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
  104. <span class="identifier">mb</span><span class="special">,</span>
  105. <span class="identifier">f</span><span class="special">,</span>
  106. <span class="identifier">g</span><span class="special">,</span>
  107. <span class="identifier">rh</span><span class="special">);</span></code>
  108. </p>
  109. </td>
  110. <td>
  111. <p>
  112. <code class="computeroutput"><span class="keyword">void</span></code>
  113. </p>
  114. </td>
  115. <td>
  116. <p>
  117. pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br>
  118. <br> Initiates an asynchronous operation to read one or more
  119. bytes of data from a connected socket <code class="computeroutput"><span class="identifier">b</span></code>.
  120. The operation is performed via the <code class="computeroutput"><span class="identifier">io_service</span></code>
  121. 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>
  122. and behaves according to <a class="link" href="asynchronous_operations.html" title="Requirements on asynchronous operations">asynchronous
  123. operation</a> requirements.<br> <br> The mutable buffer
  124. sequence <code class="computeroutput"><span class="identifier">mb</span></code> specifies
  125. memory where the data should be placed. The operation shall always
  126. fill a buffer in the sequence completely before proceeding to the
  127. next.<br> <br> The implementation shall maintain one or more
  128. copies of <code class="computeroutput"><span class="identifier">mb</span></code> until
  129. such time as the read operation no longer requires access to the
  130. memory specified by the buffers in the sequence. The program must
  131. ensure the memory is valid until:<br> <br> &#8212; the last copy of
  132. <code class="computeroutput"><span class="identifier">mb</span></code> is destroyed,
  133. or<br> <br> &#8212; the handler for the asynchronous operation is invoked,<br>
  134. <br> whichever comes first.<br> <br> If the operation completes
  135. successfully, sets <code class="computeroutput"><span class="identifier">g</span></code>
  136. to the flags associated with the received data, then invokes the
  137. <code class="computeroutput"><span class="identifier">ReadHandler</span></code> object
  138. <code class="computeroutput"><span class="identifier">rh</span></code> with the number
  139. of bytes transferred. Otherwise, sets <code class="computeroutput"><span class="identifier">g</span></code>
  140. to <code class="computeroutput"><span class="number">0</span></code> and invokes <code class="computeroutput"><span class="identifier">rh</span></code> with <code class="computeroutput"><span class="number">0</span></code>
  141. bytes transferred.
  142. </p>
  143. </td>
  144. </tr>
  145. <tr>
  146. <td>
  147. <p>
  148. <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">send</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
  149. <span class="identifier">cb</span><span class="special">,</span>
  150. <span class="identifier">f</span><span class="special">,</span>
  151. <span class="identifier">ec</span><span class="special">);</span></code>
  152. </p>
  153. </td>
  154. <td>
  155. <p>
  156. <code class="computeroutput"><span class="identifier">size_t</span></code>
  157. </p>
  158. </td>
  159. <td>
  160. <p>
  161. pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br>
  162. <br> Writes one or more bytes of data to a connected socket
  163. <code class="computeroutput"><span class="identifier">b</span></code>.<br> <br>
  164. The constant buffer sequence <code class="computeroutput"><span class="identifier">cb</span></code>
  165. specifies memory where the data to be written is located. The operation
  166. shall always write a buffer in the sequence completely before proceeding
  167. to the next.<br> <br> If successful, returns the number of
  168. bytes written. Otherwise returns <code class="computeroutput"><span class="number">0</span></code>.
  169. </p>
  170. </td>
  171. </tr>
  172. <tr>
  173. <td>
  174. <p>
  175. <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">async_send</span><span class="special">(</span><span class="identifier">b</span><span class="special">,</span>
  176. <span class="identifier">cb</span><span class="special">,</span>
  177. <span class="identifier">f</span><span class="special">,</span>
  178. <span class="identifier">wh</span><span class="special">);</span></code>
  179. </p>
  180. </td>
  181. <td>
  182. <p>
  183. <code class="computeroutput"><span class="keyword">void</span></code>
  184. </p>
  185. </td>
  186. <td>
  187. <p>
  188. pre: <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">is_open</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span></code>.<br>
  189. <br> Initiates an asynchronous operation to write one or more
  190. bytes of data to a connected socket <code class="computeroutput"><span class="identifier">b</span></code>.
  191. The operation is performed via the <code class="computeroutput"><span class="identifier">io_service</span></code>
  192. 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>
  193. and behaves according to <a class="link" href="asynchronous_operations.html" title="Requirements on asynchronous operations">asynchronous
  194. operation</a> requirements.<br> <br> The constant buffer
  195. sequence <code class="computeroutput"><span class="identifier">cb</span></code> specifies
  196. memory where the data to be written is located. The operation shall
  197. always write a buffer in the sequence completely before proceeding
  198. to the next.<br> <br> The implementation shall maintain one
  199. or more copies of <code class="computeroutput"><span class="identifier">cb</span></code>
  200. until such time as the write operation no longer requires access
  201. to the memory specified by the buffers in the sequence. The program
  202. must ensure the memory is valid until:<br> <br> &#8212; the last copy
  203. of <code class="computeroutput"><span class="identifier">cb</span></code> is destroyed,
  204. or<br> <br> &#8212; the handler for the asynchronous operation is invoked,<br>
  205. <br> whichever comes first.<br> <br> If the operation completes
  206. successfully, the <code class="computeroutput"><span class="identifier">WriteHandler</span></code>
  207. object <code class="computeroutput"><span class="identifier">wh</span></code> is invoked
  208. with the number of bytes transferred. Otherwise it is invoked with
  209. <code class="computeroutput"><span class="number">0</span></code>.
  210. </p>
  211. </td>
  212. </tr>
  213. </tbody>
  214. </table></div>
  215. </div>
  216. <br class="table-break">
  217. </div>
  218. <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
  219. <td align="left"></td>
  220. <td align="right"><div class="copyright-footer">Copyright &#169; 2003-2014 Christopher M. Kohlhoff<p>
  221. Distributed under the Boost Software License, Version 1.0. (See accompanying
  222. 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>)
  223. </p>
  224. </div></td>
  225. </tr></table>
  226. <hr>
  227. <div class="spirit-nav">
  228. <a accesskey="p" href="ResolverService.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="SerialPortService.html"><img src="../../next.png" alt="Next"></a>
  229. </div>
  230. </body>
  231. </html>