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