1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>read (14 of 16 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="../../../boost_asio.html" title="Boost.Asio"> 8<link rel="up" href="../read.html" title="read"> 9<link rel="prev" href="overload13.html" title="read (13 of 16 overloads)"> 10<link rel="next" href="overload15.html" title="read (15 of 16 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="overload13.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../read.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../boost_asio.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="overload15.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a> 24</div> 25<div class="section"> 26<div class="titlepage"><div><div><h4 class="title"> 27<a name="boost_asio.reference.read.overload14"></a><a class="link" href="overload14.html" title="read (14 of 16 overloads)">read (14 of 16 28 overloads)</a> 29</h4></div></div></div> 30<p> 31 Attempt to read a certain amount of data from a stream before returning. 32 </p> 33<pre class="programlisting">template< 34 typename <a class="link" href="../SyncReadStream.html" title="Buffer-oriented synchronous read stream requirements">SyncReadStream</a>, 35 typename <a class="link" href="../DynamicBuffer_v2.html" title="Dynamic buffer requirements (version 2)">DynamicBuffer_v2</a>> 36std::size_t read( 37 SyncReadStream & s, 38 DynamicBuffer_v2 buffers, 39 boost::system::error_code & ec, 40 typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0); 41</pre> 42<p> 43 This function is used to read a certain number of bytes of data from a 44 stream. The call will block until one of the following conditions is true: 45 </p> 46<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 47<li class="listitem"> 48 The supplied buffer is full (that is, it has reached maximum size). 49 </li> 50<li class="listitem"> 51 An error occurred. 52 </li> 53</ul></div> 54<p> 55 This operation is implemented in terms of zero or more calls to the stream's 56 read_some function. 57 </p> 58<h6> 59<a name="boost_asio.reference.read.overload14.h0"></a> 60 <span class="phrase"><a name="boost_asio.reference.read.overload14.parameters"></a></span><a class="link" href="overload14.html#boost_asio.reference.read.overload14.parameters">Parameters</a> 61 </h6> 62<div class="variablelist"> 63<p class="title"><b></b></p> 64<dl class="variablelist"> 65<dt><span class="term">s</span></dt> 66<dd><p> 67 The stream from which the data is to be read. The type must support 68 the SyncReadStream concept. 69 </p></dd> 70<dt><span class="term">buffers</span></dt> 71<dd><p> 72 The dynamic buffer sequence into which the data will be read. 73 </p></dd> 74<dt><span class="term">ec</span></dt> 75<dd><p> 76 Set to indicate what error occurred, if any. 77 </p></dd> 78</dl> 79</div> 80<h6> 81<a name="boost_asio.reference.read.overload14.h1"></a> 82 <span class="phrase"><a name="boost_asio.reference.read.overload14.return_value"></a></span><a class="link" href="overload14.html#boost_asio.reference.read.overload14.return_value">Return 83 Value</a> 84 </h6> 85<p> 86 The number of bytes transferred. 87 </p> 88<h6> 89<a name="boost_asio.reference.read.overload14.h2"></a> 90 <span class="phrase"><a name="boost_asio.reference.read.overload14.remarks"></a></span><a class="link" href="overload14.html#boost_asio.reference.read.overload14.remarks">Remarks</a> 91 </h6> 92<p> 93 This overload is equivalent to calling: 94 </p> 95<pre class="programlisting">boost::asio::read( 96 s, buffers, 97 boost::asio::transfer_all(), ec); 98</pre> 99</div> 100<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 101<td align="left"></td> 102<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M. 103 Kohlhoff<p> 104 Distributed under the Boost Software License, Version 1.0. (See accompanying 105 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>) 106 </p> 107</div></td> 108</tr></table> 109<hr> 110<div class="spirit-nav"> 111<a accesskey="p" href="overload13.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../read.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../boost_asio.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="overload15.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a> 112</div> 113</body> 114</html> 115