1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>http::write (4 of 6 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.html" title="http::write"> 9<link rel="prev" href="overload3.html" title="http::write (3 of 6 overloads)"> 10<link rel="next" href="overload5.html" title="http::write (5 of 6 overloads)"> 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="overload3.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../boost__beast__http__write.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="overload5.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.overload4"></a><a class="link" href="overload4.html" title="http::write (4 of 6 overloads)">http::write 28 (4 of 6 overloads)</a> 29</h5></div></div></div> 30<p> 31 Write a complete message to a stream. 32 </p> 33<h6> 34<a name="beast.ref.boost__beast__http__write.overload4.h0"></a> 35 <span class="phrase"><a name="beast.ref.boost__beast__http__write.overload4.synopsis"></a></span><a class="link" href="overload4.html#beast.ref.boost__beast__http__write.overload4.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</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">message</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="keyword">const</span><span class="special">&</span> <span class="identifier">msg</span><span class="special">);</span> 49</pre> 50<h6> 51<a name="beast.ref.boost__beast__http__write.overload4.h1"></a> 52 <span class="phrase"><a name="beast.ref.boost__beast__http__write.overload4.description"></a></span><a class="link" href="overload4.html#beast.ref.boost__beast__http__write.overload4.description">Description</a> 53 </h6> 54<p> 55 This function is used to write a complete message to a stream using HTTP/1. 56 The call will block until one of the following conditions is true: 57 </p> 58<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 59<li class="listitem"> 60 The entire message is written. 61 </li> 62<li class="listitem"> 63 An error occurs. 64 </li> 65</ul></div> 66<p> 67 This operation is implemented in terms of one or more calls to the stream's 68 <code class="computeroutput"><span class="identifier">write_some</span></code> function. The 69 algorithm will use a temporary <a class="link" href="../boost__beast__http__serializer.html" title="http::serializer"><code class="computeroutput"><span class="identifier">serializer</span></code></a> with an empty chunk 70 decorator to produce buffers. 71 </p> 72<h6> 73<a name="beast.ref.boost__beast__http__write.overload4.h2"></a> 74 <span class="phrase"><a name="beast.ref.boost__beast__http__write.overload4.remarks"></a></span><a class="link" href="overload4.html#beast.ref.boost__beast__http__write.overload4.remarks">Remarks</a> 75 </h6> 76<p> 77 This function only participates in overload resolution if <a class="link" href="../boost__beast__http__is_mutable_body_writer.html" title="http::is_mutable_body_writer"><code class="computeroutput"><span class="identifier">is_mutable_body_writer</span></code></a> for <span class="emphasis"><em>Body</em></span> 78 returns <code class="computeroutput"><span class="keyword">false</span></code>. 79 </p> 80<h6> 81<a name="beast.ref.boost__beast__http__write.overload4.h3"></a> 82 <span class="phrase"><a name="beast.ref.boost__beast__http__write.overload4.parameters"></a></span><a class="link" href="overload4.html#beast.ref.boost__beast__http__write.overload4.parameters">Parameters</a> 83 </h6> 84<div class="informaltable"><table class="table"> 85<colgroup> 86<col> 87<col> 88</colgroup> 89<thead><tr> 90<th> 91 <p> 92 Name 93 </p> 94 </th> 95<th> 96 <p> 97 Description 98 </p> 99 </th> 100</tr></thead> 101<tbody> 102<tr> 103<td> 104 <p> 105 <code class="computeroutput"><span class="identifier">stream</span></code> 106 </p> 107 </td> 108<td> 109 <p> 110 The stream to which the data is to be written. The type must 111 support the <span class="emphasis"><em>SyncWriteStream</em></span> concept. 112 </p> 113 </td> 114</tr> 115<tr> 116<td> 117 <p> 118 <code class="computeroutput"><span class="identifier">msg</span></code> 119 </p> 120 </td> 121<td> 122 <p> 123 The message to write. 124 </p> 125 </td> 126</tr> 127</tbody> 128</table></div> 129<h6> 130<a name="beast.ref.boost__beast__http__write.overload4.h4"></a> 131 <span class="phrase"><a name="beast.ref.boost__beast__http__write.overload4.return_value"></a></span><a class="link" href="overload4.html#beast.ref.boost__beast__http__write.overload4.return_value">Return 132 Value</a> 133 </h6> 134<p> 135 The number of bytes written to the stream. 136 </p> 137<h6> 138<a name="beast.ref.boost__beast__http__write.overload4.h5"></a> 139 <span class="phrase"><a name="beast.ref.boost__beast__http__write.overload4.exceptions"></a></span><a class="link" href="overload4.html#beast.ref.boost__beast__http__write.overload4.exceptions">Exceptions</a> 140 </h6> 141<div class="informaltable"><table class="table"> 142<colgroup> 143<col> 144<col> 145</colgroup> 146<thead><tr> 147<th> 148 <p> 149 Type 150 </p> 151 </th> 152<th> 153 <p> 154 Thrown On 155 </p> 156 </th> 157</tr></thead> 158<tbody><tr> 159<td> 160 <p> 161 <code class="computeroutput"><span class="identifier">system_error</span></code> 162 </p> 163 </td> 164<td> 165 <p> 166 Thrown on failure. 167 </p> 168 </td> 169</tr></tbody> 170</table></div> 171<h6> 172<a name="beast.ref.boost__beast__http__write.overload4.h6"></a> 173 <span class="phrase"><a name="beast.ref.boost__beast__http__write.overload4.see_also"></a></span><a class="link" href="overload4.html#beast.ref.boost__beast__http__write.overload4.see_also">See Also</a> 174 </h6> 175<p> 176 <a class="link" href="../boost__beast__http__message.html" title="http::message"><code class="computeroutput"><span class="identifier">message</span></code></a> 177 </p> 178</div> 179<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 180<td align="left"></td> 181<td align="right"><div class="copyright-footer">Copyright © 2016-2019 Vinnie 182 Falco<p> 183 Distributed under the Boost Software License, Version 1.0. (See accompanying 184 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>) 185 </p> 186</div></td> 187</tr></table> 188<hr> 189<div class="spirit-nav"> 190<a accesskey="p" href="overload3.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../boost__beast__http__write.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="overload5.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a> 191</div> 192</body> 193</html> 194