1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>http::write_some (2 of 2 overloads)</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="../../../index.html" title="Chapter 1. Boost.Beast"> 8<link rel="up" href="../boost__beast__http__write_some.html" title="http::write_some"> 9<link rel="prev" href="overload1.html" title="http::write_some (1 of 2 overloads)"> 10<link rel="next" href="../boost__beast__http__async_write_some.html" title="http::async_write_some"> 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="overload1.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../boost__beast__http__write_some.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../boost__beast__http__async_write_some.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a> 24</div> 25<div class="section"> 26<div class="titlepage"><div><div><h5 class="title"> 27<a name="beast.ref.boost__beast__http__write_some.overload2"></a><a class="link" href="overload2.html" title="http::write_some (2 of 2 overloads)">http::write_some 28 (2 of 2 overloads)</a> 29</h5></div></div></div> 30<p> 31 Write part of a message to a stream using a serializer. 32 </p> 33<h6> 34<a name="beast.ref.boost__beast__http__write_some.overload2.h0"></a> 35 <span class="phrase"><a name="beast.ref.boost__beast__http__write_some.overload2.synopsis"></a></span><a class="link" href="overload2.html#beast.ref.boost__beast__http__write_some.overload2.synopsis">Synopsis</a> 36 </h6> 37<p> 38 Defined in header <code class="literal"><<a href="../../../../../../../boost/beast/http/write.hpp" target="_top">boost/beast/http/write.hpp</a>></code> 39 </p> 40<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span> 41 <span class="keyword">class</span> <a href="../../../../../../../doc/html/boost_asio/reference/SyncWriteStream.html" target="_top"><span class="emphasis"><em>SyncWriteStream</em></span></a><span class="special">,</span> 42 <span class="keyword">bool</span> <span class="identifier">isRequest</span><span class="special">,</span> 43 <span class="keyword">class</span> <a class="link" href="../../concepts/Body.html" title="Body"><span class="emphasis"><em>Body</em></span></a><span class="special">,</span> 44 <span class="keyword">class</span> <a class="link" href="../../concepts/Fields.html" title="Fields"><span class="emphasis"><em>Fields</em></span></a><span class="special">></span> 45<span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> 46<span class="identifier">write_some</span><span class="special">(</span> 47 <span class="identifier">SyncWriteStream</span><span class="special">&</span> <span class="identifier">stream</span><span class="special">,</span> 48 <span class="identifier">serializer</span><span class="special"><</span> <span class="identifier">isRequest</span><span class="special">,</span> <span class="identifier">Body</span><span class="special">,</span> <span class="identifier">Fields</span> <span class="special">>&</span> <span class="identifier">sr</span><span class="special">,</span> 49 <span class="identifier">error_code</span><span class="special">&</span> <span class="identifier">ec</span><span class="special">);</span> 50</pre> 51<h6> 52<a name="beast.ref.boost__beast__http__write_some.overload2.h1"></a> 53 <span class="phrase"><a name="beast.ref.boost__beast__http__write_some.overload2.description"></a></span><a class="link" href="overload2.html#beast.ref.boost__beast__http__write_some.overload2.description">Description</a> 54 </h6> 55<p> 56 This function is used to write part of a message to a stream using a caller-provided 57 HTTP/1 serializer. The call will block until one of the following conditions 58 is true: 59 </p> 60<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 61<li class="listitem"> 62 One or more bytes have been transferred. 63 </li> 64<li class="listitem"> 65 The function <a class="link" href="../boost__beast__http__serializer/is_done.html" title="http::serializer::is_done"><code class="computeroutput"><span class="identifier">serializer</span><span class="special">::</span><span class="identifier">is_done</span></code></a> returns <code class="computeroutput"><span class="keyword">true</span></code> 66 </li> 67<li class="listitem"> 68 An error occurs on the stream. 69 </li> 70</ul></div> 71<p> 72 This operation is implemented in terms of one or more calls to the stream's 73 <code class="computeroutput"><span class="identifier">write_some</span></code> function. The 74 amount of data actually transferred is controlled by the behavior of the 75 underlying stream, subject to the buffer size limit of the serializer obtained 76 or set through a call to <a class="link" href="../boost__beast__http__serializer/limit/overload1.html" title="http::serializer::limit (1 of 2 overloads)"><code class="computeroutput"><span class="identifier">serializer</span><span class="special">::</span><span class="identifier">limit</span></code></a>. Setting a limit and performing 77 bounded work helps applications set reasonable timeouts. It also allows 78 application-level flow control to function correctly. For example when 79 using a TCP/IP based stream. 80 </p> 81<h6> 82<a name="beast.ref.boost__beast__http__write_some.overload2.h2"></a> 83 <span class="phrase"><a name="beast.ref.boost__beast__http__write_some.overload2.parameters"></a></span><a class="link" href="overload2.html#beast.ref.boost__beast__http__write_some.overload2.parameters">Parameters</a> 84 </h6> 85<div class="informaltable"><table class="table"> 86<colgroup> 87<col> 88<col> 89</colgroup> 90<thead><tr> 91<th> 92 <p> 93 Name 94 </p> 95 </th> 96<th> 97 <p> 98 Description 99 </p> 100 </th> 101</tr></thead> 102<tbody> 103<tr> 104<td> 105 <p> 106 <code class="computeroutput"><span class="identifier">stream</span></code> 107 </p> 108 </td> 109<td> 110 <p> 111 The stream to which the data is to be written. The type must 112 support the <span class="emphasis"><em>SyncWriteStream</em></span> concept. 113 </p> 114 </td> 115</tr> 116<tr> 117<td> 118 <p> 119 <code class="computeroutput"><span class="identifier">sr</span></code> 120 </p> 121 </td> 122<td> 123 <p> 124 The serializer to use. 125 </p> 126 </td> 127</tr> 128<tr> 129<td> 130 <p> 131 <code class="computeroutput"><span class="identifier">ec</span></code> 132 </p> 133 </td> 134<td> 135 <p> 136 Set to indicate what error occurred, if any. 137 </p> 138 </td> 139</tr> 140</tbody> 141</table></div> 142<h6> 143<a name="beast.ref.boost__beast__http__write_some.overload2.h3"></a> 144 <span class="phrase"><a name="beast.ref.boost__beast__http__write_some.overload2.return_value"></a></span><a class="link" href="overload2.html#beast.ref.boost__beast__http__write_some.overload2.return_value">Return 145 Value</a> 146 </h6> 147<p> 148 The number of bytes written to the stream. 149 </p> 150<h6> 151<a name="beast.ref.boost__beast__http__write_some.overload2.h4"></a> 152 <span class="phrase"><a name="beast.ref.boost__beast__http__write_some.overload2.see_also"></a></span><a class="link" href="overload2.html#beast.ref.boost__beast__http__write_some.overload2.see_also">See 153 Also</a> 154 </h6> 155<p> 156 <a class="link" href="../boost__beast__http__async_write_some.html" title="http::async_write_some"><code class="computeroutput"><span class="identifier">async_write_some</span></code></a>, <a class="link" href="../boost__beast__http__serializer.html" title="http::serializer"><code class="computeroutput"><span class="identifier">serializer</span></code></a> 157 </p> 158</div> 159<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 160<td align="left"></td> 161<td align="right"><div class="copyright-footer">Copyright © 2016-2019 Vinnie 162 Falco<p> 163 Distributed under the Boost Software License, Version 1.0. (See accompanying 164 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>) 165 </p> 166</div></td> 167</tr></table> 168<hr> 169<div class="spirit-nav"> 170<a accesskey="p" href="overload1.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../boost__beast__http__write_some.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../boost__beast__http__async_write_some.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a> 171</div> 172</body> 173</html> 174