SyncWriteStream.html 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
  4. <title>Buffer-oriented synchronous write 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="SyncReadStream.html" title="Buffer-oriented synchronous read stream requirements">
  10. <link rel="next" href="TimeTraits.html" title="Time traits 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="SyncReadStream.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="TimeTraits.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.SyncWriteStream"></a><a class="link" href="SyncWriteStream.html" title="Buffer-oriented synchronous write stream requirements">Buffer-oriented synchronous
  21. write 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. a synchronous write stream object, <code class="computeroutput"><span class="identifier">cb</span></code>
  26. denotes an object satisfying <a class="link" href="ConstBufferSequence.html" title="Constant buffer sequence requirements">constant
  27. buffer sequence</a> requirements, and <code class="computeroutput"><span class="identifier">ec</span></code>
  28. denotes an object of type <code class="computeroutput"><span class="identifier">error_code</span></code>.
  29. </p>
  30. <div class="table">
  31. <a name="asio.reference.SyncWriteStream.t0"></a><p class="title"><b>Table&#160;37.&#160;Buffer-oriented synchronous write stream requirements</b></p>
  32. <div class="table-contents"><table class="table" summary="Buffer-oriented synchronous write stream requirements">
  33. <colgroup>
  34. <col>
  35. <col>
  36. <col>
  37. </colgroup>
  38. <thead><tr>
  39. <th>
  40. <p>
  41. operation
  42. </p>
  43. </th>
  44. <th>
  45. <p>
  46. type
  47. </p>
  48. </th>
  49. <th>
  50. <p>
  51. semantics, pre/post-conditions
  52. </p>
  53. </th>
  54. </tr></thead>
  55. <tbody>
  56. <tr>
  57. <td>
  58. <p>
  59. <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">write_some</span><span class="special">(</span><span class="identifier">cb</span><span class="special">);</span></code>
  60. </p>
  61. </td>
  62. <td>
  63. <p>
  64. <code class="computeroutput"><span class="identifier">size_t</span></code>
  65. </p>
  66. </td>
  67. <td>
  68. <p>
  69. Equivalent to:
  70. </p>
  71. <pre class="programlisting"><span class="identifier">error_code</span> <span class="identifier">ec</span><span class="special">;</span>
  72. <span class="identifier">size_t</span> <span class="identifier">s</span> <span class="special">=</span> <span class="identifier">a</span><span class="special">.</span><span class="identifier">write_some</span><span class="special">(</span><span class="identifier">cb</span><span class="special">,</span> <span class="identifier">ec</span><span class="special">);</span>
  73. <span class="keyword">if</span> <span class="special">(</span><span class="identifier">ec</span><span class="special">)</span> <span class="keyword">throw</span> <span class="identifier">system_error</span><span class="special">(</span><span class="identifier">ec</span><span class="special">);</span>
  74. <span class="keyword">return</span> <span class="identifier">s</span><span class="special">;</span>
  75. </pre>
  76. <p>
  77. </p>
  78. </td>
  79. </tr>
  80. <tr>
  81. <td>
  82. <p>
  83. <code class="computeroutput"><span class="identifier">a</span><span class="special">.</span><span class="identifier">write_some</span><span class="special">(</span><span class="identifier">cb</span><span class="special">,</span>
  84. <span class="identifier">ec</span><span class="special">);</span></code>
  85. </p>
  86. </td>
  87. <td>
  88. <p>
  89. <code class="computeroutput"><span class="identifier">size_t</span></code>
  90. </p>
  91. </td>
  92. <td>
  93. <p>
  94. Writes one or more bytes of data to the stream <code class="computeroutput"><span class="identifier">a</span></code>.<br>
  95. <br> The constant buffer sequence <code class="computeroutput"><span class="identifier">cb</span></code>
  96. specifies memory where the data to be written is located. The
  97. <code class="computeroutput"><span class="identifier">write_some</span></code> operation
  98. shall always write a buffer in the sequence completely before proceeding
  99. to the next.<br> <br> If successful, returns the number of
  100. bytes written and sets <code class="computeroutput"><span class="identifier">ec</span></code>
  101. such that <code class="computeroutput"><span class="special">!</span><span class="identifier">ec</span></code>
  102. is true. If an error occurred, returns <code class="computeroutput"><span class="number">0</span></code>
  103. and sets <code class="computeroutput"><span class="identifier">ec</span></code> such
  104. that <code class="computeroutput"><span class="special">!!</span><span class="identifier">ec</span></code>
  105. is true.<br> <br> If the total size of all buffers in the sequence
  106. <code class="computeroutput"><span class="identifier">cb</span></code> is <code class="computeroutput"><span class="number">0</span></code>, the function shall return <code class="computeroutput"><span class="number">0</span></code> immediately.
  107. </p>
  108. </td>
  109. </tr>
  110. </tbody>
  111. </table></div>
  112. </div>
  113. <br class="table-break">
  114. </div>
  115. <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
  116. <td align="left"></td>
  117. <td align="right"><div class="copyright-footer">Copyright &#169; 2003-2014 Christopher M. Kohlhoff<p>
  118. Distributed under the Boost Software License, Version 1.0. (See accompanying
  119. 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>)
  120. </p>
  121. </div></td>
  122. </tr></table>
  123. <hr>
  124. <div class="spirit-nav">
  125. <a accesskey="p" href="SyncReadStream.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="TimeTraits.html"><img src="../../next.png" alt="Next"></a>
  126. </div>
  127. </body>
  128. </html>