Adds asio library and Storage Module
This commit is contained in:
1 parent
79a6ee5779
commit
30439acd43
4869 files changed
+618801
-903
No files matched your search
@@ -0,0 +1,105 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Accept handler requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="AcceptableProtocol.html" title="Acceptable protocol requirements">
|
||||
<link rel="next" href="AsyncRandomAccessReadDevice.html" title="Buffer-oriented asynchronous random-access read device requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="AcceptableProtocol.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="AsyncRandomAccessReadDevice.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.AcceptHandler"></a><a class="link" href="AcceptHandler.html" title="Accept handler requirements">Accept handler requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
An accept handler must meet the requirements for a <a class="link" href="Handler.html" title="Handlers">handler</a>.
|
||||
A value <code class="computeroutput">h</code> of an accept handler class should work correctly in
|
||||
the expression <code class="computeroutput">h(ec)</code>, where <code class="computeroutput">ec</code> is an lvalue of
|
||||
type <code class="computeroutput">const error_code</code>.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="asio.reference.AcceptHandler.h0"></a>
|
||||
<span><a name="asio.reference.AcceptHandler.examples"></a></span><a class="link" href="AcceptHandler.html#asio.reference.AcceptHandler.examples">Examples</a>
|
||||
</h5>
|
||||
<p>
|
||||
A free function as an accept handler:
|
||||
</p>
|
||||
<pre class="programlisting">void accept_handler(
|
||||
const asio::error_code& ec)
|
||||
{
|
||||
...
|
||||
}
|
||||
</pre>
|
||||
<p>
|
||||
An accept handler function object:
|
||||
</p>
|
||||
<pre class="programlisting">struct accept_handler
|
||||
{
|
||||
...
|
||||
void operator()(
|
||||
const asio::error_code& ec)
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
};
|
||||
</pre>
|
||||
<p>
|
||||
A lambda as an accept handler:
|
||||
</p>
|
||||
<pre class="programlisting">acceptor.async_accept(...,
|
||||
[](const asio::error_code& ec)
|
||||
{
|
||||
...
|
||||
});
|
||||
</pre>
|
||||
<p>
|
||||
A non-static class member function adapted to an accept handler using <code class="computeroutput">std::bind()</code>:
|
||||
</p>
|
||||
<pre class="programlisting">void my_class::accept_handler(
|
||||
const asio::error_code& ec)
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
acceptor.async_accept(...,
|
||||
std::bind(&my_class::accept_handler,
|
||||
this, std::placeholders::_1));
|
||||
</pre>
|
||||
<p>
|
||||
A non-static class member function adapted to an accept handler using <code class="computeroutput">boost::bind()</code>:
|
||||
</p>
|
||||
<pre class="programlisting">void my_class::accept_handler(
|
||||
const asio::error_code& ec)
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
acceptor.async_accept(...,
|
||||
boost::bind(&my_class::accept_handler,
|
||||
this, asio::placeholders::error));
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="AcceptableProtocol.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="AsyncRandomAccessReadDevice.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,88 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Acceptable protocol requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="asynchronous_socket_operations.html" title="Requirements on asynchronous socket operations">
|
||||
<link rel="next" href="AcceptHandler.html" title="Accept handler requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="asynchronous_socket_operations.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="AcceptHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.AcceptableProtocol"></a><a class="link" href="AcceptableProtocol.html" title="Acceptable protocol requirements">Acceptable protocol
|
||||
requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A type <code class="computeroutput">X</code> meets the <code class="computeroutput">AcceptableProtocol</code> requirements
|
||||
if it satisfies the requirements of <a class="link" href="Protocol.html" title="Protocol requirements"><code class="computeroutput">Protocol</code></a>
|
||||
as well as the additional requirements listed below.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.AcceptableProtocol.t0"></a><p class="title"><b>Table 1. AcceptableProtocol requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="AcceptableProtocol requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
return type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-conditions
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody><tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">X::socket</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
A type that satisfies the requirements of <code class="computeroutput">Destructible</code>
|
||||
(C++Std [destructible]) and <code class="computeroutput">MoveConstructible</code> (C++Std
|
||||
[moveconstructible]), and that is publicly and unambiguously derived
|
||||
from <code class="computeroutput">basic_socket<X></code>.
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="asynchronous_socket_operations.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="AcceptHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,128 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Buffer-oriented asynchronous random-access read device requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="AcceptHandler.html" title="Accept handler requirements">
|
||||
<link rel="next" href="AsyncRandomAccessWriteDevice.html" title="Buffer-oriented asynchronous random-access write device requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="AcceptHandler.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="AsyncRandomAccessWriteDevice.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.AsyncRandomAccessReadDevice"></a><a class="link" href="AsyncRandomAccessReadDevice.html" title="Buffer-oriented asynchronous random-access read device requirements">Buffer-oriented
|
||||
asynchronous random-access read device requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput">a</code> denotes an asynchronous random access
|
||||
read device object, <code class="computeroutput">o</code> denotes an offset of type <code class="computeroutput">boost::uint64_t</code>,
|
||||
<code class="computeroutput">mb</code> denotes an object satisfying <a class="link" href="MutableBufferSequence.html" title="Mutable buffer sequence requirements">mutable
|
||||
buffer sequence</a> requirements, and <code class="computeroutput">h</code> denotes an object
|
||||
satisfying <a class="link" href="ReadHandler.html" title="Read handler requirements">read handler</a>
|
||||
requirements.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.AsyncRandomAccessReadDevice.t0"></a><p class="title"><b>Table 2. Buffer-oriented asynchronous random-access read device requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Buffer-oriented asynchronous random-access read device requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
operation
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
semantics, pre/post-conditions
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">a.get_executor()</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
A type satisfying the <a class="link" href="Executor1.html" title="Executor requirements">Executor
|
||||
requirements</a>.
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns the associated I/O executor.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">a.async_read_some_at(o, mb, h);</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">void</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Initiates an asynchronous operation to read one or more bytes of
|
||||
data from the device <code class="computeroutput">a</code> at the offset <code class="computeroutput">o</code>.
|
||||
The operation is performed via the <code class="computeroutput">io_service</code> object
|
||||
<code class="computeroutput">a.get_io_service()</code> and behaves according to <a class="link" href="asynchronous_operations.html" title="Requirements on asynchronous operations">asynchronous operation</a>
|
||||
requirements.<br> <br> The mutable buffer sequence <code class="computeroutput">mb</code>
|
||||
specifies memory where the data should be placed. The <code class="computeroutput">async_read_some_at</code>
|
||||
operation shall always fill a buffer in the sequence completely
|
||||
before proceeding to the next.<br> <br> The implementation
|
||||
shall maintain one or more copies of <code class="computeroutput">mb</code> until such
|
||||
time as the read operation no longer requires access to the memory
|
||||
specified by the buffers in the sequence. The program must ensure
|
||||
the memory is valid until:<br> <br> — the last copy of <code class="computeroutput">mb</code>
|
||||
is destroyed, or<br> <br> — the handler for the asynchronous
|
||||
read operation is invoked,<br> <br> whichever comes first.<br>
|
||||
<br> If the total size of all buffers in the sequence <code class="computeroutput">mb</code>
|
||||
is <code class="computeroutput">0</code>, the asynchronous read operation shall complete
|
||||
immediately and pass <code class="computeroutput">0</code> as the argument to the handler
|
||||
that specifies the number of bytes read.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="AcceptHandler.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="AsyncRandomAccessWriteDevice.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,129 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Buffer-oriented asynchronous random-access write device requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="AsyncRandomAccessReadDevice.html" title="Buffer-oriented asynchronous random-access read device requirements">
|
||||
<link rel="next" href="AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="AsyncRandomAccessReadDevice.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="AsyncReadStream.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.AsyncRandomAccessWriteDevice"></a><a class="link" href="AsyncRandomAccessWriteDevice.html" title="Buffer-oriented asynchronous random-access write device requirements">Buffer-oriented
|
||||
asynchronous random-access write device requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput">a</code> denotes an asynchronous write stream object,
|
||||
<code class="computeroutput">o</code> denotes an offset of type <code class="computeroutput">boost::uint64_t</code>, <code class="computeroutput">cb</code>
|
||||
denotes an object satisfying <a class="link" href="ConstBufferSequence.html" title="Constant buffer sequence requirements">constant
|
||||
buffer sequence</a> requirements, and <code class="computeroutput">h</code> denotes an object
|
||||
satisfying <a class="link" href="WriteHandler.html" title="Write handler requirements">write handler</a>
|
||||
requirements.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.AsyncRandomAccessWriteDevice.t0"></a><p class="title"><b>Table 3. Buffer-oriented asynchronous random-access write device requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Buffer-oriented asynchronous random-access write device requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
operation
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
semantics, pre/post-conditions
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">a.get_executor()</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
A type satisfying the <a class="link" href="Executor1.html" title="Executor requirements">Executor
|
||||
requirements</a>.
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns the associated I/O executor.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">a.async_write_some_at(o, cb, h);</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">void</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Initiates an asynchronous operation to write one or more bytes
|
||||
of data to the device <code class="computeroutput">a</code> at offset <code class="computeroutput">o</code>.
|
||||
The operation is performed via the <code class="computeroutput">io_service</code> object
|
||||
<code class="computeroutput">a.get_io_service()</code> and behaves according to <a class="link" href="asynchronous_operations.html" title="Requirements on asynchronous operations">asynchronous operation</a>
|
||||
requirements.<br> <br> The constant buffer sequence <code class="computeroutput">cb</code>
|
||||
specifies memory where the data to be written is located. The
|
||||
<code class="computeroutput">async_write_some_at</code> operation shall always write a
|
||||
buffer in the sequence completely before proceeding to the next.<br>
|
||||
<br> The implementation shall maintain one or more copies of
|
||||
<code class="computeroutput">cb</code> until such time as the write operation no longer
|
||||
requires access to the memory specified by the buffers in the sequence.
|
||||
The program must ensure the memory is valid until:<br> <br>
|
||||
— the last copy of <code class="computeroutput">cb</code> is destroyed, or<br> <br>
|
||||
— the handler for the asynchronous write operation is invoked,<br>
|
||||
<br> whichever comes first.<br> <br> If the total size of
|
||||
all buffers in the sequence <code class="computeroutput">cb</code> is <code class="computeroutput">0</code>,
|
||||
the asynchronous write operation shall complete immediately and
|
||||
pass <code class="computeroutput">0</code> as the argument to the handler that specifies
|
||||
the number of bytes written.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="AsyncRandomAccessReadDevice.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="AsyncReadStream.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,129 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Buffer-oriented asynchronous read stream requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="AsyncRandomAccessWriteDevice.html" title="Buffer-oriented asynchronous random-access write device requirements">
|
||||
<link rel="next" href="AsyncWriteStream.html" title="Buffer-oriented asynchronous write stream requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="AsyncRandomAccessWriteDevice.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="AsyncWriteStream.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.AsyncReadStream"></a><a class="link" href="AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">Buffer-oriented asynchronous
|
||||
read stream requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A type <code class="computeroutput">X</code> meets the <code class="computeroutput">AsyncReadStream</code> requirements
|
||||
if it satisfies the requirements listed below.
|
||||
</p>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput">a</code> denotes a value of type <code class="computeroutput">X</code>,
|
||||
<code class="computeroutput">mb</code> denotes a (possibly const) value satisfying the <a class="link" href="MutableBufferSequence.html" title="Mutable buffer sequence requirements"><code class="computeroutput">MutableBufferSequence</code></a>
|
||||
requirements, and <code class="computeroutput">t</code> is a completion token.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.AsyncReadStream.t0"></a><p class="title"><b>Table 4. AsyncReadStream requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="AsyncReadStream requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
operation
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
semantics, pre/post-conditions
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">a.get_executor()</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
A type satisfying the <a class="link" href="Executor1.html" title="Executor requirements">Executor
|
||||
requirements</a>.
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns the associated I/O executor.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">a.async_read_some(mb,t)</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The return type is determined according to the requirements for
|
||||
an <a class="link" href="asynchronous_operations.html" title="Requirements on asynchronous operations">asynchronous
|
||||
operation</a>.
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Meets the requirements for a <a class="link" href="read_write_operations.html" title="Requirements on read and write operations">read
|
||||
operation</a> and an <a class="link" href="asynchronous_operations.html" title="Requirements on asynchronous operations">asynchronous
|
||||
operation</a> with completion signature <code class="computeroutput">void(error_code
|
||||
ec, size_t n)</code>.<br> <br> If <code class="computeroutput">buffer_size(mb) >
|
||||
0</code>, initiates an asynchronous operation to read one or more
|
||||
bytes of data from the stream <code class="computeroutput">a</code> into the buffer sequence
|
||||
<code class="computeroutput">mb</code>. If successful, <code class="computeroutput">ec</code> is set such that
|
||||
<code class="computeroutput">!ec</code> is <code class="computeroutput">true</code>, and <code class="computeroutput">n</code> is the
|
||||
number of bytes read. If an error occurred, <code class="computeroutput">ec</code> is
|
||||
set such that <code class="computeroutput">!!ec</code> is <code class="computeroutput">true</code>, and <code class="computeroutput">n</code>
|
||||
is 0. If all data has been read from the stream, and the stream
|
||||
performed an orderly shutdown, <code class="computeroutput">ec</code> is <code class="computeroutput">stream_errc::eof</code>
|
||||
and <code class="computeroutput">n</code> is 0.<br> <br> If <code class="computeroutput">buffer_size(mb)
|
||||
== 0</code>, the operation completes immediately. <code class="computeroutput">ec</code>
|
||||
is set such that <code class="computeroutput">!ec</code> is <code class="computeroutput">true</code>, and <code class="computeroutput">n</code>
|
||||
is 0.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="AsyncRandomAccessWriteDevice.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="AsyncWriteStream.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,126 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Buffer-oriented asynchronous write stream requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">
|
||||
<link rel="next" href="BufferedHandshakeHandler.html" title="Buffered handshake handler requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="AsyncReadStream.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="BufferedHandshakeHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.AsyncWriteStream"></a><a class="link" href="AsyncWriteStream.html" title="Buffer-oriented asynchronous write stream requirements">Buffer-oriented asynchronous
|
||||
write stream requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A type <code class="computeroutput">X</code> meets the <code class="computeroutput">AsyncWriteStream</code> requirements
|
||||
if it satisfies the requirements listed below.
|
||||
</p>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput">a</code> denotes a value of type <code class="computeroutput">X</code>,
|
||||
<code class="computeroutput">cb</code> denotes a (possibly const) value satisfying the <a class="link" href="ConstBufferSequence.html" title="Constant buffer sequence requirements"><code class="computeroutput">ConstBufferSequence</code></a>
|
||||
requirements, and <code class="computeroutput">t</code> is a completion token.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.AsyncWriteStream.t0"></a><p class="title"><b>Table 5. AsyncWriteStream requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="AsyncWriteStream requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
operation
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
semantics, pre/post-conditions
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">a.get_executor()</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
A type satisfying the <a class="link" href="Executor1.html" title="Executor requirements">Executor
|
||||
requirements</a>.
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns the associated I/O executor.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">a.async_write_some(cb,t)</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The return type is determined according to the requirements for
|
||||
an <a class="link" href="asynchronous_operations.html" title="Requirements on asynchronous operations">asynchronous
|
||||
operation</a>.
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Meets the requirements for a <a class="link" href="read_write_operations.html" title="Requirements on read and write operations">write
|
||||
operation</a> and an <a class="link" href="asynchronous_operations.html" title="Requirements on asynchronous operations">asynchronous
|
||||
operation</a> with completion signature <code class="computeroutput">void(error_code
|
||||
ec, size_t n)</code>.<br> <br> If <code class="computeroutput">buffer_size(cb) >
|
||||
0</code>, initiates an asynchronous operation to write one or more
|
||||
bytes of data to the stream <code class="computeroutput">a</code> from the buffer sequence
|
||||
<code class="computeroutput">cb</code>. If successful, <code class="computeroutput">ec</code> is set such that
|
||||
<code class="computeroutput">!ec</code> is <code class="computeroutput">true</code>, and <code class="computeroutput">n</code> is the
|
||||
number of bytes written. If an error occurred, <code class="computeroutput">ec</code>
|
||||
is set such that <code class="computeroutput">!!ec</code> is <code class="computeroutput">true</code>, and <code class="computeroutput">n</code>
|
||||
is 0.<br> <br> If <code class="computeroutput">buffer_size(cb) == 0</code>, the operation
|
||||
completes immediately. <code class="computeroutput">ec</code> is set such that <code class="computeroutput">!ec</code>
|
||||
is <code class="computeroutput">true</code>, and <code class="computeroutput">n</code> is 0.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="AsyncReadStream.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="BufferedHandshakeHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,90 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Buffered handshake handler requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="AsyncWriteStream.html" title="Buffer-oriented asynchronous write stream requirements">
|
||||
<link rel="next" href="CompletionCondition.html" title="Completion condition requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="AsyncWriteStream.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="CompletionCondition.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.BufferedHandshakeHandler"></a><a class="link" href="BufferedHandshakeHandler.html" title="Buffered handshake handler requirements">Buffered handshake
|
||||
handler requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A buffered handshake handler must meet the requirements for a <a class="link" href="Handler.html" title="Handlers">handler</a>.
|
||||
A value <code class="computeroutput">h</code> of a buffered handshake handler class should work
|
||||
correctly in the expression <code class="computeroutput">h(ec, s)</code>, where <code class="computeroutput">ec</code>
|
||||
is an lvalue of type <code class="computeroutput">const error_code</code> and <code class="computeroutput">s</code> is
|
||||
an lvalue of type <code class="computeroutput">const size_t</code>.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="asio.reference.BufferedHandshakeHandler.h0"></a>
|
||||
<span><a name="asio.reference.BufferedHandshakeHandler.examples"></a></span><a class="link" href="BufferedHandshakeHandler.html#asio.reference.BufferedHandshakeHandler.examples">Examples</a>
|
||||
</h5>
|
||||
<p>
|
||||
A free function as a buffered handshake handler:
|
||||
</p>
|
||||
<pre class="programlisting">void handshake_handler(
|
||||
const asio::error_code& ec,
|
||||
std::size_t bytes_transferred)
|
||||
{
|
||||
...
|
||||
}
|
||||
</pre>
|
||||
<p>
|
||||
A buffered handshake handler function object:
|
||||
</p>
|
||||
<pre class="programlisting">struct handshake_handler
|
||||
{
|
||||
...
|
||||
void operator()(
|
||||
const asio::error_code& ec,
|
||||
std::size_t bytes_transferred)
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
};
|
||||
</pre>
|
||||
<p>
|
||||
A non-static class member function adapted to a buffered handshake handler
|
||||
using <code class="computeroutput">boost::bind()</code>:
|
||||
</p>
|
||||
<pre class="programlisting">void my_class::handshake_handler(
|
||||
const asio::error_code& ec,
|
||||
std::size_t bytes_transferred)
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
socket.async_handshake(...,
|
||||
boost::bind(&my_class::handshake_handler,
|
||||
this, asio::placeholders::error,
|
||||
asio::placeholders::bytes_transferred));
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="AsyncWriteStream.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="CompletionCondition.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,106 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Completion condition requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="BufferedHandshakeHandler.html" title="Buffered handshake handler requirements">
|
||||
<link rel="next" href="CompletionHandler.html" title="Completion handler requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BufferedHandshakeHandler.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="CompletionHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.CompletionCondition"></a><a class="link" href="CompletionCondition.html" title="Completion condition requirements">Completion condition
|
||||
requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A <span class="emphasis"><em>completion condition</em></span> is a function object that is
|
||||
used with the algorithms <a class="link" href="read.html" title="read"><code class="computeroutput">read</code></a>,
|
||||
<a class="link" href="async_read.html" title="async_read"><code class="computeroutput">async_read</code></a>,
|
||||
<a class="link" href="write.html" title="write"><code class="computeroutput">write</code></a>, and <a class="link" href="async_write.html" title="async_write"><code class="computeroutput">async_write</code></a> to determine
|
||||
when the algorithm has completed transferring data.
|
||||
</p>
|
||||
<p>
|
||||
A type <code class="computeroutput">X</code> meets the <code class="computeroutput">CompletionCondition</code> requirements
|
||||
if it satisfies the requirements of <code class="computeroutput">Destructible</code> (C++Std [destructible])
|
||||
and <code class="computeroutput">MoveConstructible</code> (C++Std [moveconstructible]), as well
|
||||
as the additional requirements listed below.
|
||||
</p>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput">x</code> denotes a value of type <code class="computeroutput">X</code>,
|
||||
<code class="computeroutput">ec</code> denotes a (possibly const) value of type <code class="computeroutput">error_code</code>,
|
||||
and <code class="computeroutput">n</code> denotes a (possibly const) value of type <code class="computeroutput">size_t</code>.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.CompletionCondition.t0"></a><p class="title"><b>Table 6. CompletionCondition requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="CompletionCondition requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
return type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-condition
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody><tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">x(ec, n)</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">size_t</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Let <code class="computeroutput">n</code> be the total number of bytes transferred by
|
||||
the read or write algorithm so far.<br> <br> Returns the maximum
|
||||
number of bytes to be transferred on the next <code class="computeroutput">read_some</code>,
|
||||
<code class="computeroutput">async_read_some</code>, <code class="computeroutput">write_some</code>, or <code class="computeroutput">async_write_some</code>
|
||||
operation performed by the algorithm. Returns <code class="computeroutput">0</code> to
|
||||
indicate that the algorithm is complete.
|
||||
</p>
|
||||
</td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="BufferedHandshakeHandler.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="CompletionHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,99 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Completion handler requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="CompletionCondition.html" title="Completion condition requirements">
|
||||
<link rel="next" href="ConnectCondition.html" title="Connect condition requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="CompletionCondition.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="ConnectCondition.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.CompletionHandler"></a><a class="link" href="CompletionHandler.html" title="Completion handler requirements">Completion handler
|
||||
requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A completion handler must meet the requirements for a <a class="link" href="Handler.html" title="Handlers">handler</a>.
|
||||
A value <code class="computeroutput">h</code> of a completion handler class should work correctly
|
||||
in the expression <code class="computeroutput">h()</code>.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="asio.reference.CompletionHandler.h0"></a>
|
||||
<span><a name="asio.reference.CompletionHandler.examples"></a></span><a class="link" href="CompletionHandler.html#asio.reference.CompletionHandler.examples">Examples</a>
|
||||
</h5>
|
||||
<p>
|
||||
A free function as a completion handler:
|
||||
</p>
|
||||
<pre class="programlisting">void completion_handler()
|
||||
{
|
||||
...
|
||||
}
|
||||
</pre>
|
||||
<p>
|
||||
A completion handler function object:
|
||||
</p>
|
||||
<pre class="programlisting">struct completion_handler
|
||||
{
|
||||
...
|
||||
void operator()()
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
};
|
||||
</pre>
|
||||
<p>
|
||||
A lambda as a completion handler:
|
||||
</p>
|
||||
<pre class="programlisting">my_io_service.post(
|
||||
[]()
|
||||
{
|
||||
...
|
||||
});
|
||||
</pre>
|
||||
<p>
|
||||
A non-static class member function adapted to a completion handler using
|
||||
<code class="computeroutput">std::bind()</code>:
|
||||
</p>
|
||||
<pre class="programlisting">void my_class::completion_handler()
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
my_io_service.post(std::bind(&my_class::completion_handler, this));
|
||||
</pre>
|
||||
<p>
|
||||
A non-static class member function adapted to a completion handler using
|
||||
<code class="computeroutput">boost::bind()</code>:
|
||||
</p>
|
||||
<pre class="programlisting">void my_class::completion_handler()
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
my_io_service.post(boost::bind(&my_class::completion_handler, this));
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="CompletionCondition.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="ConnectCondition.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,99 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Connect condition requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="CompletionHandler.html" title="Completion handler requirements">
|
||||
<link rel="next" href="ConnectHandler.html" title="Connect handler requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="CompletionHandler.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="ConnectHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.ConnectCondition"></a><a class="link" href="ConnectCondition.html" title="Connect condition requirements">Connect condition requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A type <code class="computeroutput">X</code> meets the <code class="computeroutput">ConnectCondition</code> requirements
|
||||
if it satisfies the requirements of <code class="computeroutput">Destructible</code> (C++Std [destructible])
|
||||
and <code class="computeroutput">CopyConstructible</code> (C++Std [copyconstructible]), as well
|
||||
as the additional requirements listed below.
|
||||
</p>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput">x</code> denotes a value of type <code class="computeroutput">X</code>,
|
||||
<code class="computeroutput">ec</code> denotes a (possibly const) value of type <code class="computeroutput">error_code</code>,
|
||||
and <code class="computeroutput">ep</code> denotes a (possibly const) value of some type satisfying
|
||||
the <a class="link" href="Endpoint.html" title="Endpoint requirements">endpoint</a> requirements.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.ConnectCondition.t0"></a><p class="title"><b>Table 7. ConnectCondition requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="ConnectCondition requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
return type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-condition
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody><tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">x(ec, ep)</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">bool</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns <code class="computeroutput">true</code> to indicate that the <code class="computeroutput">connect</code>
|
||||
or <code class="computeroutput">async_connect</code> algorithm should attempt a connection
|
||||
to the endpoint <code class="computeroutput">ep</code>. Otherwise, returns <code class="computeroutput">false</code>
|
||||
to indicate that the algorithm should not attempt connection to
|
||||
the endpoint <code class="computeroutput">ep</code>, and should instead skip to the next
|
||||
endpoint in the sequence.
|
||||
</p>
|
||||
</td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="CompletionHandler.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="ConnectHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,105 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Connect handler requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="ConnectCondition.html" title="Connect condition requirements">
|
||||
<link rel="next" href="ConstBufferSequence.html" title="Constant buffer sequence requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="ConnectCondition.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="ConstBufferSequence.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.ConnectHandler"></a><a class="link" href="ConnectHandler.html" title="Connect handler requirements">Connect handler requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A connect handler must meet the requirements for a <a class="link" href="Handler.html" title="Handlers">handler</a>.
|
||||
A value <code class="computeroutput">h</code> of a connect handler class should work correctly in
|
||||
the expression <code class="computeroutput">h(ec)</code>, where <code class="computeroutput">ec</code> is an lvalue of
|
||||
type <code class="computeroutput">const error_code</code>.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="asio.reference.ConnectHandler.h0"></a>
|
||||
<span><a name="asio.reference.ConnectHandler.examples"></a></span><a class="link" href="ConnectHandler.html#asio.reference.ConnectHandler.examples">Examples</a>
|
||||
</h5>
|
||||
<p>
|
||||
A free function as a connect handler:
|
||||
</p>
|
||||
<pre class="programlisting">void connect_handler(
|
||||
const asio::error_code& ec)
|
||||
{
|
||||
...
|
||||
}
|
||||
</pre>
|
||||
<p>
|
||||
A connect handler function object:
|
||||
</p>
|
||||
<pre class="programlisting">struct connect_handler
|
||||
{
|
||||
...
|
||||
void operator()(
|
||||
const asio::error_code& ec)
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
};
|
||||
</pre>
|
||||
<p>
|
||||
A lambda as a connect handler:
|
||||
</p>
|
||||
<pre class="programlisting">socket.async_connect(...,
|
||||
[](const asio::error_code& ec)
|
||||
{
|
||||
...
|
||||
});
|
||||
</pre>
|
||||
<p>
|
||||
A non-static class member function adapted to a connect handler using <code class="computeroutput">std::bind()</code>:
|
||||
</p>
|
||||
<pre class="programlisting">void my_class::connect_handler(
|
||||
const asio::error_code& ec)
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
socket.async_connect(...,
|
||||
std::bind(&my_class::connect_handler,
|
||||
this, std::placeholders::_1));
|
||||
</pre>
|
||||
<p>
|
||||
A non-static class member function adapted to a connect handler using <code class="computeroutput">boost::bind()</code>:
|
||||
</p>
|
||||
<pre class="programlisting">void my_class::connect_handler(
|
||||
const asio::error_code& ec)
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
socket.async_connect(...,
|
||||
boost::bind(&my_class::connect_handler,
|
||||
this, asio::placeholders::error));
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="ConnectCondition.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="ConstBufferSequence.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,130 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Constant buffer sequence requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="ConnectHandler.html" title="Connect handler requirements">
|
||||
<link rel="next" href="DynamicBuffer.html" title="Dynamic buffer requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="ConnectHandler.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="DynamicBuffer.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.ConstBufferSequence"></a><a class="link" href="ConstBufferSequence.html" title="Constant buffer sequence requirements">Constant buffer sequence
|
||||
requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A <span class="emphasis"><em>constant buffer sequence</em></span> represents a set of memory
|
||||
regions that may be used as input to an operation, such as the <code class="computeroutput">send</code>
|
||||
operation of a socket.
|
||||
</p>
|
||||
<p>
|
||||
A type <code class="computeroutput">X</code> meets the <code class="computeroutput">ConstBufferSequence</code> requirements
|
||||
if it satisfies the requirements of <code class="computeroutput">Destructible</code> (C++Std [destructible])
|
||||
and <code class="computeroutput">CopyConstructible</code> (C++Std [copyconstructible]), as well
|
||||
as the additional requirements listed below.
|
||||
</p>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput">x</code> denotes a (possibly const) value of type
|
||||
<code class="computeroutput">X</code>, and <code class="computeroutput">u</code> denotes an identifier.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.ConstBufferSequence.t0"></a><p class="title"><b>Table 8. ConstBufferSequence requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="ConstBufferSequence requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
return type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-condition
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">asio::buffer_sequence_begin(x)</code><br> <code class="computeroutput">asio::buffer_sequence_end(x)</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
An iterator type meeting the requirements for bidirectional iterators
|
||||
(C++Std [bidirectional.iterators]) whose value type is convertible
|
||||
to <code class="computeroutput">const_buffer</code>.
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting">X u(x);
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
post:<br>
|
||||
</p>
|
||||
<pre class="programlisting">equal(
|
||||
asio::buffer_sequence_begin(x),
|
||||
asio::buffer_sequence_end(x),
|
||||
asio::buffer_sequence_begin(u),
|
||||
asio::buffer_sequence_end(u),
|
||||
[](const const_buffer& b1,
|
||||
const const_buffer& b2)
|
||||
{
|
||||
return b1.data() == b2.data()
|
||||
&& b1.size() == b2.size();
|
||||
})
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="ConnectHandler.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="DynamicBuffer.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,50 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Dynamic buffer requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="ConstBufferSequence.html" title="Constant buffer sequence requirements">
|
||||
<link rel="next" href="DynamicBuffer_v1.html" title="Dynamic buffer requirements (version 1)">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="ConstBufferSequence.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="DynamicBuffer_v1.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.DynamicBuffer"></a><a class="link" href="DynamicBuffer.html" title="Dynamic buffer requirements">Dynamic buffer requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
See:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
<a class="link" href="DynamicBuffer_v1.html" title="Dynamic buffer requirements (version 1)">Dynamic buffer requirements
|
||||
(version 1)</a>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<a class="link" href="DynamicBuffer_v2.html" title="Dynamic buffer requirements (version 2)">Dynamic buffer requirements
|
||||
(version 2)</a>
|
||||
</li>
|
||||
</ul></div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="ConstBufferSequence.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="DynamicBuffer_v1.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,258 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Dynamic buffer requirements (version 1)</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="DynamicBuffer.html" title="Dynamic buffer requirements">
|
||||
<link rel="next" href="DynamicBuffer_v2.html" title="Dynamic buffer requirements (version 2)">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="DynamicBuffer.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="DynamicBuffer_v2.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.DynamicBuffer_v1"></a><a class="link" href="DynamicBuffer_v1.html" title="Dynamic buffer requirements (version 1)">Dynamic buffer requirements
|
||||
(version 1)</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A dynamic buffer encapsulates memory storage that may be automatically resized
|
||||
as required, where the memory is divided into an input sequence followed
|
||||
by an output sequence. These memory regions are internal to the dynamic buffer
|
||||
sequence, but direct access to the elements is provided to permit them to
|
||||
be efficiently used with I/O operations, such as the <code class="computeroutput">send</code> or
|
||||
<code class="computeroutput">receive</code> operations of a socket. Data written to the output sequence
|
||||
of a dynamic buffer sequence object is appended to the input sequence of
|
||||
the same object.
|
||||
</p>
|
||||
<p>
|
||||
A dynamic buffer type <code class="computeroutput">X</code> shall satisfy the requirements of <code class="computeroutput">MoveConstructible</code>
|
||||
(C++ Std, [moveconstructible]) types in addition to those listed below.
|
||||
</p>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput">X</code> denotes a dynamic buffer class, <code class="computeroutput">x</code>
|
||||
denotes a value of type <code class="computeroutput">X&</code>, <code class="computeroutput">x1</code> denotes values
|
||||
of type <code class="computeroutput">const X&</code>, and <code class="computeroutput">n</code> denotes a value of
|
||||
type <code class="computeroutput">size_t</code>, and <code class="computeroutput">u</code> denotes an identifier.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.DynamicBuffer_v1.t0"></a><p class="title"><b>Table 9. DynamicBuffer_v1 requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="DynamicBuffer_v1 requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-conditions
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">X::const_buffers_type</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
type meeting <a class="link" href="ConstBufferSequence.html" title="Constant buffer sequence requirements">ConstBufferSequence</a>
|
||||
requirements.
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
This type represents the memory associated with the input sequence.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">X::mutable_buffers_type</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
type meeting <a class="link" href="MutableBufferSequence.html" title="Mutable buffer sequence requirements">MutableBufferSequence</a>
|
||||
requirements.
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
This type represents the memory associated with the output sequence.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">x1.size()</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">size_t</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns the size, in bytes, of the input sequence.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">x1.max_size()</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">size_t</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns the permitted maximum of the sum of the sizes of the input
|
||||
sequence and output sequence.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">x1.capacity()</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">size_t</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns the maximum sum of the sizes of the input sequence and
|
||||
output sequence that the dynamic buffer can hold without requiring
|
||||
reallocation.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">x1.data()</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">X::const_buffers_type</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a constant buffer sequence <code class="computeroutput">u</code> that represents
|
||||
the memory associated with the input sequence, and where <code class="computeroutput">buffer_size(u)
|
||||
== size()</code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">x.prepare(n)</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">X::mutable_buffers_type</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Requires: <code class="computeroutput">size() + n <= max_size()</code>.<br> <br>
|
||||
Returns a mutable buffer sequence <code class="computeroutput">u</code> representing the
|
||||
output sequence, and where <code class="computeroutput">buffer_size(u) == n</code>. The
|
||||
dynamic buffer reallocates memory as required. All constant or
|
||||
mutable buffer sequences previously obtained using <code class="computeroutput">data()</code>
|
||||
or <code class="computeroutput">prepare()</code> are invalidated.<br> <br> Throws:
|
||||
<code class="computeroutput">length_error</code> if <code class="computeroutput">size() + n > max_size()</code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">x.commit(n)</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Appends <code class="computeroutput">n</code> bytes from the start of the output sequence
|
||||
to the end of the input sequence. The remainder of the output sequence
|
||||
is discarded. If <code class="computeroutput">n</code> is greater than the size of the
|
||||
output sequence, the entire output sequence is appended to the
|
||||
input sequence. All constant or mutable buffer sequences previously
|
||||
obtained using <code class="computeroutput">data()</code> or <code class="computeroutput">prepare()</code> are
|
||||
invalidated.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">x.consume(n)</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Removes <code class="computeroutput">n</code> bytes from beginning of the input sequence.
|
||||
If <code class="computeroutput">n</code> is greater than the size of the input sequence,
|
||||
the entire input sequence is removed. All constant or mutable buffer
|
||||
sequences previously obtained using <code class="computeroutput">data()</code> or <code class="computeroutput">prepare()</code>
|
||||
are invalidated.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="DynamicBuffer.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="DynamicBuffer_v2.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,265 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Dynamic buffer requirements (version 2)</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="DynamicBuffer_v1.html" title="Dynamic buffer requirements (version 1)">
|
||||
<link rel="next" href="Endpoint.html" title="Endpoint requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="DynamicBuffer_v1.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="Endpoint.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.DynamicBuffer_v2"></a><a class="link" href="DynamicBuffer_v2.html" title="Dynamic buffer requirements (version 2)">Dynamic buffer requirements
|
||||
(version 2)</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A dynamic buffer encapsulates memory storage that may be automatically resized
|
||||
as required.
|
||||
</p>
|
||||
<p>
|
||||
A dynamic buffer type <code class="computeroutput">X</code> shall satisfy the requirements of <code class="computeroutput">CopyConstructible</code>
|
||||
(C++ Std, [copyconstructible]) types in addition to those listed below.
|
||||
</p>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput">X</code> denotes a dynamic buffer class, <code class="computeroutput">x</code>
|
||||
denotes a value of type <code class="computeroutput">X&</code>, <code class="computeroutput">x1</code> denotes values
|
||||
of type <code class="computeroutput">const X&</code>, <code class="computeroutput">pos</code> and <code class="computeroutput">n</code> denote
|
||||
values of type <code class="computeroutput">size_t</code>, and <code class="computeroutput">u</code> denotes an identifier.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.DynamicBuffer_v2.t0"></a><p class="title"><b>Table 10. DynamicBuffer_v2 requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="DynamicBuffer_v2 requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-conditions
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">X::const_buffers_type</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
type meeting <a class="link" href="ConstBufferSequence.html" title="Constant buffer sequence requirements">ConstBufferSequence</a>
|
||||
requirements.
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
This type represents the underlying memory as a sequence of @c
|
||||
const_buffer objects.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">X::mutable_buffers_type</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
type meeting <a class="link" href="MutableBufferSequence.html" title="Mutable buffer sequence requirements">MutableBufferSequence</a>
|
||||
requirements.
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
This type represents the underlying memory as a sequence of @c
|
||||
mutable_buffer objects.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">x1.size()</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">size_t</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns the size, in bytes, of the underlying memory.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">x1.max_size()</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">size_t</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns the permitted maximum size of the underlying memory.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">x1.capacity()</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">size_t</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns the maximum size to which the underlying memory can grow
|
||||
without requiring reallocation.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">x1.data(pos, n)</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">X::const_buffers_type</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a constant buffer sequence <code class="computeroutput">u</code> that represents
|
||||
the underlying memory beginning at offset <code class="computeroutput">pos</code>, and
|
||||
where <code class="computeroutput">buffer_size(u) <= n</code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">x.data(pos, n)</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">X::mutable_buffers_type</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a mutable buffer sequence <code class="computeroutput">u</code> that represents
|
||||
the underlying memory beginning at offset <code class="computeroutput">pos</code>, and
|
||||
where <code class="computeroutput">buffer_size(u) <= n</code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">x.grow(n)</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Requires: <code class="computeroutput">size() + n <= max_size()</code>.<br> <br>
|
||||
Extends the underlying memory to accommodate <code class="computeroutput">n</code> additional
|
||||
bytes at the end. The dynamic buffer reallocates memory as required.
|
||||
All constant or mutable buffer sequences previously obtained using
|
||||
<code class="computeroutput">data()</code> are invalidated.<br> <br> Throws: <code class="computeroutput">length_error</code>
|
||||
if <code class="computeroutput">size() + n > max_size()</code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">x.shrink(n)</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Removes <code class="computeroutput">n</code> bytes from the end of the underlying memory.
|
||||
If <code class="computeroutput">n</code> is greater than the size of the underlying memory,
|
||||
the entire underlying memory is emptied. All constant or mutable
|
||||
buffer sequences previously obtained using <code class="computeroutput">data()</code>
|
||||
are invalidated.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">x.consume(n)</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Removes <code class="computeroutput">n</code> bytes from the beginning of the underlying
|
||||
memory. If <code class="computeroutput">n</code> is greater than the size of the underlying
|
||||
memory, the entire underlying memory is emptied. All constant or
|
||||
mutable buffer sequences previously obtained using <code class="computeroutput">data()</code>
|
||||
are invalidated.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="DynamicBuffer_v1.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="Endpoint.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,256 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Endpoint requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="DynamicBuffer_v2.html" title="Dynamic buffer requirements (version 2)">
|
||||
<link rel="next" href="EndpointSequence.html" title="Endpoint sequence requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="DynamicBuffer_v2.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="EndpointSequence.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.Endpoint"></a><a class="link" href="Endpoint.html" title="Endpoint requirements">Endpoint requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A type <code class="computeroutput">X</code> meets the <code class="computeroutput">Endpoint</code> requirements if it
|
||||
satisfies the requirements of <code class="computeroutput">Destructible</code> (C++Std [destructible]),
|
||||
<code class="computeroutput">DefaultConstructible</code> (C++Std [defaultconstructible]), <code class="computeroutput">CopyConstructible</code>
|
||||
(C++Std [copyconstructible]), and <code class="computeroutput">CopyAssignable</code> (C++Std [copyassignable]),
|
||||
as well as the additional requirements listed below.
|
||||
</p>
|
||||
<p>
|
||||
The default constructor and move operations of the type <code class="computeroutput">X</code> shall
|
||||
not exit via an exception.
|
||||
</p>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput">a</code> denotes a (possibly const) value of type
|
||||
<code class="computeroutput">X</code>, and <code class="computeroutput">u</code> denotes an identifier.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.Endpoint.t0"></a><p class="title"><b>Table 11. Endpoint requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Endpoint requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-conditions
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">X::protocol_type</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
type meeting <a class="link" href="Protocol.html" title="Protocol requirements"><code class="computeroutput">Protocol</code></a>
|
||||
requirements
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">a.protocol()</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">protocol_type</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break"><p>
|
||||
In the table below, <code class="computeroutput">a</code> denotes a (possibly const) value of type
|
||||
<code class="computeroutput">X</code>, <code class="computeroutput">b</code> denotes a value of type <code class="computeroutput">X</code>, and
|
||||
<code class="computeroutput">s</code> denotes a (possibly const) value of a type that is convertible
|
||||
to <code class="computeroutput">size_t</code> and denotes a size in bytes.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.Endpoint.t1"></a><p class="title"><b>Table 12. Endpoint requirements for extensible implementations</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Endpoint requirements for extensible implementations">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-conditions
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">a.data()</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">const void*</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a pointer suitable for passing as the <span class="emphasis"><em>address</em></span>
|
||||
argument to functions such as <span class="emphasis"><em>POSIX</em></span> <a href="http://www.opengroup.org/onlinepubs/9699919799/functions/connect.html" target="_top"><code class="computeroutput"><span class="identifier">connect</span><span class="special">()</span></code></a>,
|
||||
or as the <span class="emphasis"><em>dest_addr</em></span> argument to functions
|
||||
such as <span class="emphasis"><em>POSIX</em></span> <a href="http://www.opengroup.org/onlinepubs/9699919799/functions/sendto.html" target="_top"><code class="computeroutput"><span class="identifier">sendto</span><span class="special">()</span></code></a>.
|
||||
The implementation shall perform a <code class="computeroutput">static_cast</code> on
|
||||
the pointer to convert it to <code class="computeroutput">const sockaddr*</code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">b.data()</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">void*</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a pointer suitable for passing as the <span class="emphasis"><em>address</em></span>
|
||||
argument to functions such as <span class="emphasis"><em>POSIX</em></span> <a href="http://www.opengroup.org/onlinepubs/9699919799/functions/accept.html" target="_top"><code class="computeroutput"><span class="identifier">accept</span><span class="special">()</span></code></a>,
|
||||
<a href="http://www.opengroup.org/onlinepubs/9699919799/functions/getpeername.html" target="_top"><code class="computeroutput"><span class="identifier">getpeername</span><span class="special">()</span></code></a>,
|
||||
<a href="http://www.opengroup.org/onlinepubs/9699919799/functions/getsockname.html" target="_top"><code class="computeroutput"><span class="identifier">getsockname</span><span class="special">()</span></code></a>
|
||||
and <a href="http://www.opengroup.org/onlinepubs/9699919799/functions/recvfrom.html" target="_top"><code class="computeroutput"><span class="identifier">recvfrom</span><span class="special">()</span></code></a>.
|
||||
The implementation shall perform a <code class="computeroutput">static_cast</code> on
|
||||
the pointer to convert it to <code class="computeroutput">sockaddr*</code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">a.size()</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">size_t</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a value suitable for passing as the <span class="emphasis"><em>address_len</em></span>
|
||||
argument to functions such as <span class="emphasis"><em>POSIX</em></span> <a href="http://www.opengroup.org/onlinepubs/9699919799/functions/connect.html" target="_top"><code class="computeroutput"><span class="identifier">connect</span><span class="special">()</span></code></a>,
|
||||
or as the <span class="emphasis"><em>dest_len</em></span> argument to functions such
|
||||
as <span class="emphasis"><em>POSIX</em></span> <a href="http://www.opengroup.org/onlinepubs/9699919799/functions/sendto.html" target="_top"><code class="computeroutput"><span class="identifier">sendto</span><span class="special">()</span></code></a>,
|
||||
after appropriate integer conversion has been performed.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">b.resize(s)</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
pre: <code class="computeroutput">s >= 0</code><br> post: <code class="computeroutput">a.size() == s</code><br>
|
||||
Passed the value contained in the <span class="emphasis"><em>address_len</em></span>
|
||||
argument to functions such as <span class="emphasis"><em>POSIX</em></span> <a href="http://www.opengroup.org/onlinepubs/9699919799/functions/accept.html" target="_top"><code class="computeroutput"><span class="identifier">accept</span><span class="special">()</span></code></a>,
|
||||
<a href="http://www.opengroup.org/onlinepubs/9699919799/functions/getpeername.html" target="_top"><code class="computeroutput"><span class="identifier">getpeername</span><span class="special">()</span></code></a>,
|
||||
<a href="http://www.opengroup.org/onlinepubs/9699919799/functions/getsockname.html" target="_top"><code class="computeroutput"><span class="identifier">getsockname</span><span class="special">()</span></code></a>
|
||||
and <a href="http://www.opengroup.org/onlinepubs/9699919799/functions/recvfrom.html" target="_top"><code class="computeroutput"><span class="identifier">recvfrom</span><span class="special">()</span></code></a>,
|
||||
after successful completion of the function. Permitted to throw
|
||||
an exception if the protocol associated with the endpoint object
|
||||
<code class="computeroutput">a</code> does not support the specified size.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">a.capacity()</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">size_t</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a value suitable for passing as the <span class="emphasis"><em>address_len</em></span>
|
||||
argument to functions such as <span class="emphasis"><em>POSIX</em></span> <a href="http://www.opengroup.org/onlinepubs/9699919799/functions/accept.html" target="_top"><code class="computeroutput"><span class="identifier">accept</span><span class="special">()</span></code></a>,
|
||||
<a href="http://www.opengroup.org/onlinepubs/9699919799/functions/getpeername.html" target="_top"><code class="computeroutput"><span class="identifier">getpeername</span><span class="special">()</span></code></a>,
|
||||
<a href="http://www.opengroup.org/onlinepubs/9699919799/functions/getsockname.html" target="_top"><code class="computeroutput"><span class="identifier">getsockname</span><span class="special">()</span></code></a>
|
||||
and <a href="http://www.opengroup.org/onlinepubs/9699919799/functions/recvfrom.html" target="_top"><code class="computeroutput"><span class="identifier">recvfrom</span><span class="special">()</span></code></a>,
|
||||
after appropriate integer conversion has been performed.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="DynamicBuffer_v2.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="EndpointSequence.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,94 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Endpoint sequence requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="Endpoint.html" title="Endpoint requirements">
|
||||
<link rel="next" href="ExecutionContext.html" title="Execution context requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="Endpoint.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="ExecutionContext.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.EndpointSequence"></a><a class="link" href="EndpointSequence.html" title="Endpoint sequence requirements">Endpoint sequence requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A type <code class="computeroutput">X</code> meets the <code class="computeroutput">EndpointSequence</code> requirements
|
||||
if it satisfies the requirements of <code class="computeroutput">Destructible</code> (C++Std [destructible])
|
||||
and <code class="computeroutput">CopyConstructible</code> (C++Std [copyconstructible]), as well
|
||||
as the additional requirements listed below.
|
||||
</p>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput">x</code> denotes a (possibly const) value of type
|
||||
<code class="computeroutput">X</code>.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.EndpointSequence.t0"></a><p class="title"><b>Table 13. EndpointSequence requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="EndpointSequence requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
return type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-condition
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody><tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">x.begin()</code><br> <code class="computeroutput">x.end()</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
A type meeting the requirements for forward iterators (C++Std [forward.iterators])
|
||||
whose value type is convertible to a type satisfying the <a class="link" href="Endpoint.html" title="Endpoint requirements"><code class="computeroutput">Endpoint</code></a>
|
||||
requirements.
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
[<code class="computeroutput">x.begin()</code>,<code class="computeroutput">x.end()</code>) is a valid range.
|
||||
</p>
|
||||
</td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="Endpoint.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="ExecutionContext.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,123 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Execution context requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="EndpointSequence.html" title="Endpoint sequence requirements">
|
||||
<link rel="next" href="Executor1.html" title="Executor requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="EndpointSequence.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="Executor1.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.ExecutionContext"></a><a class="link" href="ExecutionContext.html" title="Execution context requirements">Execution context requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A type <code class="computeroutput">X</code> meets the <code class="computeroutput">ExecutionContext</code> requirements
|
||||
if it is publicly and unambiguously derived from <code class="computeroutput">execution_context</code>,
|
||||
and satisfies the additional requirements listed below.
|
||||
</p>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput">x</code> denotes a value of type <code class="computeroutput">X</code>.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.ExecutionContext.t0"></a><p class="title"><b>Table 14. ExecutionContext requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="ExecutionContext requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
return type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-condition
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">X::executor_type</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
type meeting <a class="link" href="Executor1.html" title="Executor requirements"><code class="computeroutput">Executor</code></a>
|
||||
requirements
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">x.~X()</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Destroys all unexecuted function objects that were submitted via
|
||||
an executor object that is associated with the execution context.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">x.get_executor()</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">X::executor_type</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns an executor object that is associated with the execution
|
||||
context.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="EndpointSequence.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="Executor1.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,404 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Executor requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="ExecutionContext.html" title="Execution context requirements">
|
||||
<link rel="next" href="GettableSerialPortOption.html" title="Gettable serial port option requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="ExecutionContext.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="GettableSerialPortOption.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.Executor1"></a><a class="link" href="Executor1.html" title="Executor requirements">Executor requirements</a>
|
||||
</h3></div></div></div>
|
||||
<h5>
|
||||
<a name="asio.reference.Executor1.h0"></a>
|
||||
<span><a name="asio.reference.Executor1.standard_executors"></a></span><a class="link" href="Executor1.html#asio.reference.Executor1.standard_executors">Standard
|
||||
executors</a>
|
||||
</h5>
|
||||
<p>
|
||||
Let <code class="computeroutput">executor-of-impl</code> be the exposition-only concept
|
||||
</p>
|
||||
<pre class="programlisting">template<class E, class F>
|
||||
concept executor-of-impl =
|
||||
invocable<decay_t<F>&> &&
|
||||
constructible_from<decay_t<F>, F> &&
|
||||
move_constructible<decay_t<F>> &&
|
||||
copy_constructible<E> &&
|
||||
is_nothrow_copy_constructible_v<E> &&
|
||||
equality_comparable<E> /* nothrow */ &&
|
||||
requires(const E& e, F&& f) {
|
||||
execution::execute(e, (F&&)f);
|
||||
};
|
||||
</pre>
|
||||
<p>
|
||||
Then the <code class="computeroutput">executor</code> and <code class="computeroutput">executor_of</code> concepts are
|
||||
defined as follows:
|
||||
</p>
|
||||
<pre class="programlisting">template<class E>
|
||||
concept executor =
|
||||
executor-of-impl<E, execution::invocable_archetype>;
|
||||
|
||||
template<class E, class F>
|
||||
concept executor_of =
|
||||
executor<E> &&
|
||||
executor-of-impl<E, F>;
|
||||
</pre>
|
||||
<p>
|
||||
Neither an executor's equality comparison nor <code class="computeroutput">swap</code> operation
|
||||
shall exit via an exception.
|
||||
</p>
|
||||
<p>
|
||||
None of an executor type's copy constructor, destructor, equality comparison,
|
||||
<code class="computeroutput">swap</code> function, <code class="computeroutput">execute</code> function, or associated
|
||||
<code class="computeroutput">query</code> functions shall introduce data races as a result of concurrent
|
||||
invocations of those functions from different threads.
|
||||
</p>
|
||||
<p>
|
||||
For any two (possibly const) values <code class="computeroutput">x1</code> and <code class="computeroutput">x2</code> of
|
||||
some executor type <code class="computeroutput">X</code>, <code class="computeroutput">x1 == x2</code> shall return <code class="computeroutput">true</code>
|
||||
only if <code class="computeroutput">asio::query(x1,p) == asio::query(x2,p)</code> for every property
|
||||
<code class="computeroutput">p</code> where both <code class="computeroutput">asio::query(x1,p)</code> and <code class="computeroutput">asio::query(x2,p)</code>
|
||||
are well-formed and result in a non-void type that is <code class="computeroutput">equality_comparable</code>
|
||||
(C++Std [equalitycomparable]). [<span class="emphasis"><em>Note:</em></span> The above requirements
|
||||
imply that <code class="computeroutput">x1 == x2</code> returns <code class="computeroutput">true</code> if <code class="computeroutput">x1</code>
|
||||
and <code class="computeroutput">x2</code> can be interchanged with identical effects. An executor
|
||||
may conceptually contain additional properties which are not exposed by a
|
||||
named property type that can be observed via <code class="computeroutput">asio::query</code>; in
|
||||
this case, it is up to the concrete executor implementation to decide if
|
||||
these properties affect equality. Returning <code class="computeroutput">false</code> does not necessarily
|
||||
imply that the effects are not identical. —<span class="emphasis"><em>end note</em></span>]
|
||||
</p>
|
||||
<p>
|
||||
An executor type's destructor shall not block pending completion of the submitted
|
||||
function objects. [<span class="emphasis"><em>Note:</em></span> The ability to wait for completion
|
||||
of submitted function objects may be provided by the associated execution
|
||||
context. —<span class="emphasis"><em>end note</em></span>]
|
||||
</p>
|
||||
<p>
|
||||
In addition to the above requirements, types <code class="computeroutput">E</code> and <code class="computeroutput">F</code>
|
||||
model <code class="computeroutput">executor_of</code> only if they satisfy the requirements of the
|
||||
Table below.
|
||||
</p>
|
||||
<p>
|
||||
Let:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
<code class="computeroutput">e</code> denotes a (possibly const) executor object of type <code class="computeroutput">E</code>,
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<code class="computeroutput">cf</code> denotes the function object <code class="computeroutput">DECAY_COPY(std::forward<F>(f))</code>
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<code class="computeroutput">f</code> denotes a function of type <code class="computeroutput">F&&</code> invocable
|
||||
as <code class="computeroutput">cf()</code> and where <code class="computeroutput">decay_t<F></code> models
|
||||
<code class="computeroutput">move_constructible</code>.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
The expression <code class="computeroutput">execution::execute(e, f)</code>:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
Evaluates <code class="computeroutput">DECAY_COPY(std::forward<F>(f))</code> on the calling
|
||||
thread to create <code class="computeroutput">cf</code> that will be invoked at most once by
|
||||
an execution agent.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
May block pending completion of this invocation. Synchronizes with [intro.multithread]
|
||||
the invocation of <code class="computeroutput">f</code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Shall not propagate any exception thrown by the function object or any
|
||||
other function submitted to the executor.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
[<span class="emphasis"><em>Note:</em></span> The treatment of exceptions thrown by one-way
|
||||
submitted functions is implementation-defined. The forward progress guarantee
|
||||
of the associated execution agent(s) is implementation-defined. —<span class="emphasis"><em>end
|
||||
note</em></span>]
|
||||
</p>
|
||||
<h5>
|
||||
<a name="asio.reference.Executor1.h1"></a>
|
||||
<span><a name="asio.reference.Executor1.networking_ts_style_executors"></a></span><a class="link" href="Executor1.html#asio.reference.Executor1.networking_ts_style_executors">Networking
|
||||
TS-style executors</a>
|
||||
</h5>
|
||||
<p>
|
||||
The library describes a standard set of requirements for <span class="emphasis"><em>executors</em></span>.
|
||||
A type meeting the <code class="computeroutput">Executor</code> requirements embodies a set of rules
|
||||
for determining how submitted function objects are to be executed.
|
||||
</p>
|
||||
<p>
|
||||
A type <code class="computeroutput">X</code> meets the <code class="computeroutput">Executor</code> requirements if it
|
||||
satisfies the requirements of <code class="computeroutput">CopyConstructible</code> (C++Std [copyconstructible])
|
||||
and <code class="computeroutput">Destructible</code> (C++Std [destructible]), as well as the additional
|
||||
requirements listed below.
|
||||
</p>
|
||||
<p>
|
||||
No constructor, comparison operator, copy operation, move operation, swap
|
||||
operation, or member functions <code class="computeroutput">context</code>, <code class="computeroutput">on_work_started</code>,
|
||||
and <code class="computeroutput">on_work_finished</code> on these types shall exit via an exception.
|
||||
</p>
|
||||
<p>
|
||||
The executor copy constructor, comparison operators, and other member functions
|
||||
defined in these requirements shall not introduce data races as a result
|
||||
of concurrent calls to those functions from different threads.
|
||||
</p>
|
||||
<p>
|
||||
Let <code class="computeroutput">ctx</code> be the execution context returned by the executor's
|
||||
<code class="computeroutput">context()</code> member function. An executor becomes <span class="emphasis"><em>invalid</em></span>
|
||||
when the first call to <code class="computeroutput">ctx.shutdown()</code> returns. The effect of
|
||||
calling <code class="computeroutput">on_work_started</code>, <code class="computeroutput">on_work_finished</code>, <code class="computeroutput">dispatch</code>,
|
||||
<code class="computeroutput">post</code>, or <code class="computeroutput">defer</code> on an invalid executor is undefined.
|
||||
[<span class="emphasis"><em>Note:</em></span> The copy constructor, comparison operators, and
|
||||
<code class="computeroutput">context()</code> member function continue to remain valid until <code class="computeroutput">ctx</code>
|
||||
is destroyed. —<span class="emphasis"><em>end note</em></span>]
|
||||
</p>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput">x1</code> and <code class="computeroutput">x2</code> denote (possibly
|
||||
const) values of type <code class="computeroutput">X</code>, <code class="computeroutput">mx1</code> denotes an xvalue
|
||||
of type <code class="computeroutput">X</code>, <code class="computeroutput">f</code> denotes a <code class="computeroutput">MoveConstructible</code>
|
||||
(C++Std [moveconstructible]) function object callable with zero arguments,
|
||||
<code class="computeroutput">a</code> denotes a (possibly const) value of type <code class="computeroutput">A</code> meeting
|
||||
the <code class="computeroutput">Allocator</code> requirements (C++Std [allocator.requirements]),
|
||||
and <code class="computeroutput">u</code> denotes an identifier.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.Executor1.t0"></a><p class="title"><b>Table 15. Executor requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Executor requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-conditions
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">X u(x1);</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Shall not exit via an exception.<br> <br> post: <code class="computeroutput">u ==
|
||||
x1</code> and <code class="computeroutput">std::addressof(u.context()) == std::addressof(x1.context()).</code>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">X u(mx1);</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Shall not exit via an exception.<br> <br> post: <code class="computeroutput">u</code>
|
||||
equals the prior value of <code class="computeroutput">mx1</code> and <code class="computeroutput">std::addressof(u.context())</code>
|
||||
equals the prior value of <code class="computeroutput">std::addressof(mx1.context())</code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">x1 == x2</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">bool</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns <code class="computeroutput">true</code> only if <code class="computeroutput">x1</code> and <code class="computeroutput">x2</code>
|
||||
can be interchanged with identical effects in any of the expressions
|
||||
defined in these type requirements. [<span class="emphasis"><em>Note:</em></span>
|
||||
Returning <code class="computeroutput">false</code> does not necessarily imply that the
|
||||
effects are not identical. —<span class="emphasis"><em>end note</em></span>] <br>
|
||||
<br> <code class="computeroutput">operator==</code> shall be reflexive, symmetric, and
|
||||
transitive, and shall not exit via an exception.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">x1 != x2</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">bool</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Same as <code class="computeroutput">!(x1 == x2)</code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">x1.context()</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">execution_context&</code>, or <code class="computeroutput">E&</code> where
|
||||
<code class="computeroutput">E</code> is a type that satifisfies the <a class="link" href="ExecutionContext.html" title="Execution context requirements"><code class="computeroutput">ExecutionContext</code></a>
|
||||
requirements.
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Shall not exit via an exception.<br> <br> The comparison operators
|
||||
and member functions defined in these requirements shall not alter
|
||||
the reference returned by this function.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">x1.on_work_started()</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Shall not exit via an exception.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">x1.on_work_finished()</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Shall not exit via an exception.<br> <br> Precondition: A preceding
|
||||
call <code class="computeroutput">x2.on_work_started()</code> where <code class="computeroutput">x1 == x2</code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">x1.dispatch(std::move(f),a)</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Effects: Creates an object <code class="computeroutput">f1</code> initialized with <code class="literal"><span class="emphasis"><em>DECAY_COPY</em></span></code><code class="computeroutput">(forward<Func>(f))</code>
|
||||
(C++Std [thread.decaycopy]) in the current thread of execution
|
||||
. Calls <code class="computeroutput">f1()</code> at most once. The executor may block
|
||||
forward progress of the caller until <code class="computeroutput">f1()</code> finishes
|
||||
execution.<br> <br> Executor implementations should use the
|
||||
supplied allocator to allocate any memory required to store the
|
||||
function object. Prior to invoking the function object, the executor
|
||||
shall deallocate any memory allocated. [<span class="emphasis"><em>Note:</em></span>
|
||||
Executors defined in this Technical Specification always use the
|
||||
supplied allocator unless otherwise specified. —<span class="emphasis"><em>end note</em></span>]
|
||||
<br> <br> Synchronization: The invocation of <code class="computeroutput">dispatch</code>
|
||||
synchronizes with (C++Std [intro.multithread]) the invocation of
|
||||
<code class="computeroutput">f1</code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">x1.post(std::move(f),a)</code><br> <code class="computeroutput">x1.defer(std::move(f),a)</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Effects: Creates an object <code class="computeroutput">f1</code> initialized with <code class="literal"><span class="emphasis"><em>DECAY_COPY</em></span></code><code class="computeroutput">(forward<Func>(f))</code>
|
||||
in the current thread of execution. Calls <code class="computeroutput">f1()</code> at
|
||||
most once. The executor shall not block forward progress of the
|
||||
caller pending completion of <code class="computeroutput">f1()</code>.<br> <br> Executor
|
||||
implementations should use the supplied allocator to allocate any
|
||||
memory required to store the function object. Prior to invoking
|
||||
the function object, the executor shall deallocate any memory allocated.
|
||||
[<span class="emphasis"><em>Note:</em></span> Executors defined in this Technical
|
||||
Specification always use the supplied allocator unless otherwise
|
||||
specified. —<span class="emphasis"><em>end note</em></span>] <br> <br> Synchronization:
|
||||
The invocation of <code class="computeroutput">post</code> or <code class="computeroutput">defer</code> synchronizes
|
||||
with (C++Std [intro.multithread]) the invocation of <code class="computeroutput">f1</code>.<br>
|
||||
<br> [<span class="emphasis"><em>Note:</em></span> Although the requirements placed
|
||||
on <code class="computeroutput">defer</code> are identical to <code class="computeroutput">post</code>, the use
|
||||
of <code class="computeroutput">post</code> conveys a preference that the caller <span class="emphasis"><em>does
|
||||
not</em></span> block the first step of <code class="literal">f1</code>'s
|
||||
progress, whereas <code class="computeroutput">defer</code> conveys a preference that
|
||||
the caller <span class="emphasis"><em>does</em></span> block the first step of <code class="literal">f1</code>.
|
||||
One use of <code class="computeroutput">defer</code> is to convey the intention of the
|
||||
caller that <code class="literal">f1</code> is a continuation of the current
|
||||
call context. The executor may use this information to optimize
|
||||
or otherwise adjust the way in which <code class="computeroutput">f1</code> is invoked.
|
||||
—<span class="emphasis"><em>end note</em></span>]
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="ExecutionContext.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="GettableSerialPortOption.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,95 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Gettable serial port option requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="Executor1.html" title="Executor requirements">
|
||||
<link rel="next" href="GettableSocketOption.html" title="Gettable socket option requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="Executor1.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="GettableSocketOption.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.GettableSerialPortOption"></a><a class="link" href="GettableSerialPortOption.html" title="Gettable serial port option requirements">Gettable serial
|
||||
port option requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput">X</code> denotes a serial port option class, <code class="computeroutput">a</code>
|
||||
denotes a value of <code class="computeroutput">X</code>, <code class="computeroutput">ec</code> denotes a value of type
|
||||
<code class="computeroutput">error_code</code>, and <code class="computeroutput">s</code> denotes a value of implementation-defined
|
||||
type <span class="emphasis"><em><code class="literal">storage</code></em></span> (where <span class="emphasis"><em><code class="literal">storage</code></em></span>
|
||||
is the type <code class="computeroutput">DCB</code> on Windows and <code class="computeroutput">termios</code> on <span class="emphasis"><em>POSIX</em></span>
|
||||
platforms), and <code class="computeroutput">u</code> denotes an identifier.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.GettableSerialPortOption.t0"></a><p class="title"><b>Table 16. GettableSerialPortOption requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="GettableSerialPortOption requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-conditions
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody><tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">const </code><span class="emphasis"><em><code class="literal">storage</code></em></span><code class="computeroutput">&
|
||||
u = s;</code><br> <code class="computeroutput">a.load(u, ec);</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">error_code</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Retrieves the value of the serial port option from the storage.<br>
|
||||
<br> If successful, sets <code class="computeroutput">ec</code> such that <code class="computeroutput">!ec</code>
|
||||
is true. If an error occurred, sets <code class="computeroutput">ec</code> such that
|
||||
<code class="computeroutput">!!ec</code> is true. Returns <code class="computeroutput">ec</code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="Executor1.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="GettableSocketOption.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,175 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Gettable socket option requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="GettableSerialPortOption.html" title="Gettable serial port option requirements">
|
||||
<link rel="next" href="Handler.html" title="Handlers">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="GettableSerialPortOption.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="Handler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.GettableSocketOption"></a><a class="link" href="GettableSocketOption.html" title="Gettable socket option requirements">Gettable socket
|
||||
option requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A type <code class="computeroutput">X</code> meets the <code class="computeroutput">GettableSocketOption</code> requirements
|
||||
if it satisfies the requirements listed below.
|
||||
</p>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput">a</code> denotes a (possibly const) value of type
|
||||
<code class="computeroutput">X</code>, <code class="computeroutput">b</code> denotes a value of type <code class="computeroutput">X</code>, <code class="computeroutput">p</code>
|
||||
denotes a (possibly const) value that meets the <a class="link" href="Protocol.html" title="Protocol requirements"><code class="computeroutput">Protocol</code></a>
|
||||
requirements, and <code class="computeroutput">s</code> denotes a (possibly const) value of a type
|
||||
that is convertible to <code class="computeroutput">size_t</code> and denotes a size in bytes.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.GettableSocketOption.t0"></a><p class="title"><b>Table 17. GettableSocketOption requirements for extensible implementations</b></p>
|
||||
<div class="table-contents"><table class="table" summary="GettableSocketOption requirements for extensible implementations">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-conditions
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">a.level(p)</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">int</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a value suitable for passing as the <span class="emphasis"><em>level</em></span>
|
||||
argument to <span class="emphasis"><em>POSIX</em></span> <a href="http://www.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html" target="_top"><code class="computeroutput"><span class="identifier">getsockopt</span><span class="special">()</span></code></a>
|
||||
(or equivalent).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">a.name(p)</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">int</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a value suitable for passing as the <span class="emphasis"><em>option_name</em></span>
|
||||
argument to <span class="emphasis"><em>POSIX</em></span> <a href="http://www.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html" target="_top"><code class="computeroutput"><span class="identifier">getsockopt</span><span class="special">()</span></code></a>
|
||||
(or equivalent).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">b.data(p)</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">void*</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a pointer suitable for passing as the <span class="emphasis"><em>option_value</em></span>
|
||||
argument to <span class="emphasis"><em>POSIX</em></span> <a href="http://www.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html" target="_top"><code class="computeroutput"><span class="identifier">getsockopt</span><span class="special">()</span></code></a>
|
||||
(or equivalent).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">a.size(p)</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">size_t</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a value suitable for passing as the <span class="emphasis"><em>option_len</em></span>
|
||||
argument to <span class="emphasis"><em>POSIX</em></span> <a href="http://www.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html" target="_top"><code class="computeroutput"><span class="identifier">getsockopt</span><span class="special">()</span></code></a>
|
||||
(or equivalent), after appropriate integer conversion has been
|
||||
performed.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">b.resize(p,s)</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
post: <code class="computeroutput">b.size(p) == s</code>.<br> Passed the value contained
|
||||
in the <span class="emphasis"><em>option_len</em></span> argument to <span class="emphasis"><em>POSIX</em></span>
|
||||
<a href="http://www.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html" target="_top"><code class="computeroutput"><span class="identifier">getsockopt</span><span class="special">()</span></code></a>
|
||||
(or equivalent) after successful completion of the function. Permitted
|
||||
to throw an exception if the socket option object <code class="computeroutput">b</code>
|
||||
does not support the specified size.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="GettableSerialPortOption.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="Handler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,150 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Handlers</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="GettableSocketOption.html" title="Gettable socket option requirements">
|
||||
<link rel="next" href="HandshakeHandler.html" title="SSL handshake handler requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="GettableSocketOption.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="HandshakeHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.Handler"></a><a class="link" href="Handler.html" title="Handlers">Handlers</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A handler must meet the requirements of <code class="computeroutput">MoveConstructible</code> types
|
||||
(C++Std [moveconstructible]).
|
||||
</p>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput">X</code> denotes a handler class, <code class="computeroutput">h</code>
|
||||
denotes a value of <code class="computeroutput">X</code>, <code class="computeroutput">p</code> denotes a pointer to a
|
||||
block of allocated memory of type <code class="computeroutput">void*</code>, <code class="computeroutput">s</code> denotes
|
||||
the size for a block of allocated memory, and <code class="computeroutput">f</code> denotes a function
|
||||
object taking no arguments.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.Handler.t0"></a><p class="title"><b>Table 18. Handler requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Handler requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
return type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-conditions
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting">using asio::asio_handler_allocate;
|
||||
asio_handler_allocate(s, &h);
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">void*</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a pointer to a block of memory of size <code class="computeroutput">s</code>.
|
||||
The pointer must satisfy the same alignment requirements as a pointer
|
||||
returned by <code class="computeroutput">::operator new()</code>. Throws <code class="computeroutput">bad_alloc</code>
|
||||
on failure.<br> <br> The <code class="computeroutput">asio_handler_allocate()</code>
|
||||
function is located using argument-dependent lookup. The function
|
||||
<code class="computeroutput">asio::asio_handler_allocate()</code> serves as a default
|
||||
if no user-supplied function is available.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting">using asio::asio_handler_deallocate;
|
||||
asio_handler_deallocate(p, s, &h);
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Frees a block of memory associated with a pointer <code class="computeroutput">p</code>,
|
||||
of at least size <code class="computeroutput">s</code>, that was previously allocated
|
||||
using <code class="computeroutput">asio_handler_allocate()</code>.<br> <br> The <code class="computeroutput">asio_handler_deallocate()</code>
|
||||
function is located using argument-dependent lookup. The function
|
||||
<code class="computeroutput">asio::asio_handler_deallocate()</code> serves as a default
|
||||
if no user-supplied function is available.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting">using asio::asio_handler_invoke;
|
||||
asio_handler_invoke(f, &h);
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Causes the function object <code class="computeroutput">f</code> to be executed as if
|
||||
by calling <code class="computeroutput">f()</code>.<br> <br> The <code class="computeroutput">asio_handler_invoke()</code>
|
||||
function is located using argument-dependent lookup. The function
|
||||
<code class="computeroutput">asio::asio_handler_invoke()</code> serves as a default if
|
||||
no user-supplied function is available.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="GettableSocketOption.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="HandshakeHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,108 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>SSL handshake handler requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="Handler.html" title="Handlers">
|
||||
<link rel="next" href="InternetProtocol.html" title="Internet protocol requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="Handler.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="InternetProtocol.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.HandshakeHandler"></a><a class="link" href="HandshakeHandler.html" title="SSL handshake handler requirements">SSL handshake handler
|
||||
requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A handshake handler must meet the requirements for a <a class="link" href="Handler.html" title="Handlers">handler</a>.
|
||||
A value <code class="computeroutput">h</code> of a handshake handler class should work correctly
|
||||
in the expression <code class="computeroutput">h(ec)</code>, where <code class="computeroutput">ec</code> is an lvalue
|
||||
of type <code class="computeroutput">const error_code</code>.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="asio.reference.HandshakeHandler.h0"></a>
|
||||
<span><a name="asio.reference.HandshakeHandler.examples"></a></span><a class="link" href="HandshakeHandler.html#asio.reference.HandshakeHandler.examples">Examples</a>
|
||||
</h5>
|
||||
<p>
|
||||
A free function as a handshake handler:
|
||||
</p>
|
||||
<pre class="programlisting">void handshake_handler(
|
||||
const asio::error_code& ec)
|
||||
{
|
||||
...
|
||||
}
|
||||
</pre>
|
||||
<p>
|
||||
A handshake handler function object:
|
||||
</p>
|
||||
<pre class="programlisting">struct handshake_handler
|
||||
{
|
||||
...
|
||||
void operator()(
|
||||
const asio::error_code& ec)
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
};
|
||||
</pre>
|
||||
<p>
|
||||
A lambda as a handshake handler:
|
||||
</p>
|
||||
<pre class="programlisting">ssl_stream.async_handshake(...,
|
||||
[](const asio::error_code& ec)
|
||||
{
|
||||
...
|
||||
});
|
||||
</pre>
|
||||
<p>
|
||||
A non-static class member function adapted to a handshake handler using
|
||||
<code class="computeroutput">std::bind()</code>:
|
||||
</p>
|
||||
<pre class="programlisting">void my_class::handshake_handler(
|
||||
const asio::error_code& ec)
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
ssl_stream.async_handshake(...,
|
||||
std::bind(&my_class::handshake_handler,
|
||||
this, std::placeholders::_1));
|
||||
</pre>
|
||||
<p>
|
||||
A non-static class member function adapted to a handshake handler using
|
||||
<code class="computeroutput">boost::bind()</code>:
|
||||
</p>
|
||||
<pre class="programlisting">void my_class::handshake_handler(
|
||||
const asio::error_code& ec)
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
ssl_stream.async_handshake(...,
|
||||
boost::bind(&my_class::handshake_handler,
|
||||
this, asio::placeholders::error));
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="Handler.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="InternetProtocol.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,163 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Internet protocol requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="HandshakeHandler.html" title="SSL handshake handler requirements">
|
||||
<link rel="next" href="IoControlCommand.html" title="I/O control command requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="HandshakeHandler.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="IoControlCommand.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.InternetProtocol"></a><a class="link" href="InternetProtocol.html" title="Internet protocol requirements">Internet protocol requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A type <code class="computeroutput">X</code> meets the <code class="computeroutput">InternetProtocol</code> requirements
|
||||
if it satisfies the requirements of <a class="link" href="AcceptableProtocol.html" title="Acceptable protocol requirements"><code class="computeroutput">AcceptableProtocol</code></a>,
|
||||
as well as the additional requirements listed below.
|
||||
</p>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput">a</code> denotes a (possibly const) value of type
|
||||
<code class="computeroutput">X</code>, and <code class="computeroutput">b</code> denotes a (possibly const) value of type
|
||||
<code class="computeroutput">X</code>.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.InternetProtocol.t0"></a><p class="title"><b>Table 19. InternetProtocol requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="InternetProtocol requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
return type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-conditions
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">X::resolver</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">ip::basic_resolver<X></code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The type of a resolver for the protocol.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">X::v4()</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">X</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns an object representing the IP version 4 protocol.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">X::v6()</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">X</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns an object representing the IP version 6 protocol.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">a == b</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
convertible to <code class="computeroutput">bool</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns <code class="computeroutput">true</code> if <code class="computeroutput">a</code> and <code class="computeroutput">b</code>
|
||||
represent the same IP protocol version, otherwise <code class="computeroutput">false</code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">a != b</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
convertible to <code class="computeroutput">bool</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns <code class="computeroutput">!(a == b)</code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="HandshakeHandler.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="IoControlCommand.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,109 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>I/O control command requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="InternetProtocol.html" title="Internet protocol requirements">
|
||||
<link rel="next" href="IoObjectService.html" title="I/O object service requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="InternetProtocol.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="IoObjectService.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.IoControlCommand"></a><a class="link" href="IoControlCommand.html" title="I/O control command requirements">I/O control command
|
||||
requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A type <code class="computeroutput">X</code> meets the <code class="computeroutput">IoControlCommand</code> requirements
|
||||
if it satisfies the requirements listed below.
|
||||
</p>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput">a</code> denotes a (possibly const) value of type
|
||||
<code class="computeroutput">X</code>, and <code class="computeroutput">b</code> denotes a value of type <code class="computeroutput">X</code>.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.IoControlCommand.t0"></a><p class="title"><b>Table 20. IoControlCommand requirements for extensible implementations</b></p>
|
||||
<div class="table-contents"><table class="table" summary="IoControlCommand requirements for extensible implementations">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-conditions
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">a.name()</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">int</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a value suitable for passing as the <span class="emphasis"><em>request</em></span>
|
||||
argument to <span class="emphasis"><em>POSIX</em></span> <a href="http://www.opengroup.org/onlinepubs/9699919799/functions/ioctl.html" target="_top"><code class="computeroutput"><span class="identifier">ioctl</span><span class="special">()</span></code></a>
|
||||
(or equivalent).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">b.data()</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">void*</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="InternetProtocol.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="IoObjectService.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,170 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>I/O object service requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="IoControlCommand.html" title="I/O control command requirements">
|
||||
<link rel="next" href="IteratorConnectHandler.html" title="Iterator connect handler requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="IoControlCommand.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="IteratorConnectHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.IoObjectService"></a><a class="link" href="IoObjectService.html" title="I/O object service requirements">I/O object service requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
An I/O object service must meet the requirements for a <a class="link" href="Service.html" title="Service requirements">service</a>,
|
||||
as well as the requirements listed below.
|
||||
</p>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput">X</code> denotes an I/O object service class,
|
||||
<code class="computeroutput">a</code> and <code class="computeroutput">ao</code> denote values of type <code class="computeroutput">X</code>,
|
||||
<code class="computeroutput">b</code> and <code class="computeroutput">c</code> denote values of type <code class="computeroutput">X::implementation_type</code>,
|
||||
and <code class="computeroutput">u</code> denotes an identifier.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.IoObjectService.t0"></a><p class="title"><b>Table 21. IoObjectService requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="IoObjectService requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
return type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-condition
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">X::implementation_type</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">X::implementation_type u;</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
note: <code class="computeroutput">X::implementation_type</code> has a public default
|
||||
constructor and destructor.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting">a.construct(b);
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting">a.destroy(b);
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
note: <code class="computeroutput">destroy()</code> will only be called on a value that
|
||||
has previously been initialised with <code class="computeroutput">construct()</code> or
|
||||
<code class="computeroutput">move_construct()</code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting">a.move_construct(b, c);
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
note: only required for I/O objects that support movability.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting">a.move_assign(b, ao, c);
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
note: only required for I/O objects that support movability.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="IoControlCommand.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="IteratorConnectHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,118 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Iterator connect handler requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="IoObjectService.html" title="I/O object service requirements">
|
||||
<link rel="next" href="LegacyCompletionHandler.html" title="Legacy completion handler requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="IoObjectService.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="LegacyCompletionHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.IteratorConnectHandler"></a><a class="link" href="IteratorConnectHandler.html" title="Iterator connect handler requirements">Iterator connect
|
||||
handler requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
An iterator connect handler must meet the requirements for a <a class="link" href="Handler.html" title="Handlers">handler</a>.
|
||||
A value <code class="computeroutput">h</code> of an iterator connect handler class should work correctly
|
||||
in the expression <code class="computeroutput">h(ec, i)</code>, where <code class="computeroutput">ec</code> is an lvalue
|
||||
of type <code class="computeroutput">const error_code</code> and <code class="computeroutput">i</code> is an lvalue of
|
||||
the type <code class="computeroutput">Iterator</code> used in the corresponding <code class="computeroutput">connect()</code>
|
||||
or async_connect()` function.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="asio.reference.IteratorConnectHandler.h0"></a>
|
||||
<span><a name="asio.reference.IteratorConnectHandler.examples"></a></span><a class="link" href="IteratorConnectHandler.html#asio.reference.IteratorConnectHandler.examples">Examples</a>
|
||||
</h5>
|
||||
<p>
|
||||
A free function as an iterator connect handler:
|
||||
</p>
|
||||
<pre class="programlisting">void connect_handler(
|
||||
const asio::error_code& ec,
|
||||
asio::ip::tcp::resolver::iterator iterator)
|
||||
{
|
||||
...
|
||||
}
|
||||
</pre>
|
||||
<p>
|
||||
An iterator connect handler function object:
|
||||
</p>
|
||||
<pre class="programlisting">struct connect_handler
|
||||
{
|
||||
...
|
||||
template <typename Iterator>
|
||||
void operator()(
|
||||
const asio::error_code& ec,
|
||||
Iterator iterator)
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
};
|
||||
</pre>
|
||||
<p>
|
||||
A lambda as an iterator connect handler:
|
||||
</p>
|
||||
<pre class="programlisting">asio::async_connect(...,
|
||||
[](const asio::error_code& ec,
|
||||
asio::ip::tcp::resolver::iterator iterator)
|
||||
{
|
||||
...
|
||||
});
|
||||
</pre>
|
||||
<p>
|
||||
A non-static class member function adapted to an iterator connect handler
|
||||
using <code class="computeroutput">std::bind()</code>:
|
||||
</p>
|
||||
<pre class="programlisting">void my_class::connect_handler(
|
||||
const asio::error_code& ec,
|
||||
asio::ip::tcp::resolver::iterator iterator)
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
asio::async_connect(...,
|
||||
std::bind(&my_class::connect_handler,
|
||||
this, std::placeholders::_1,
|
||||
std::placeholders::_2));
|
||||
</pre>
|
||||
<p>
|
||||
A non-static class member function adapted to an iterator connect handler
|
||||
using <code class="computeroutput">boost::bind()</code>:
|
||||
</p>
|
||||
<pre class="programlisting">void my_class::connect_handler(
|
||||
const asio::error_code& ec,
|
||||
asio::ip::tcp::resolver::iterator iterator)
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
asio::async_connect(...,
|
||||
boost::bind(&my_class::connect_handler,
|
||||
this, asio::placeholders::error,
|
||||
asio::placeholders::iterator));
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="IoObjectService.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="LegacyCompletionHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,100 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Legacy completion handler requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="IteratorConnectHandler.html" title="Iterator connect handler requirements">
|
||||
<link rel="next" href="MoveAcceptHandler.html" title="Move accept handler requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="IteratorConnectHandler.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="MoveAcceptHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.LegacyCompletionHandler"></a><a class="link" href="LegacyCompletionHandler.html" title="Legacy completion handler requirements">Legacy completion
|
||||
handler requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A legacy completion handler must meet the requirements for a <a class="link" href="Handler.html" title="Handlers">handler</a>.
|
||||
A legacy completion handler must meet the requirements of <code class="computeroutput">CopyConstructible</code>
|
||||
types (C++Std [copyconstructible]). A value <code class="computeroutput">h</code> of a completion
|
||||
handler class should work correctly in the expression <code class="computeroutput">h()</code>.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="asio.reference.LegacyCompletionHandler.h0"></a>
|
||||
<span><a name="asio.reference.LegacyCompletionHandler.examples"></a></span><a class="link" href="LegacyCompletionHandler.html#asio.reference.LegacyCompletionHandler.examples">Examples</a>
|
||||
</h5>
|
||||
<p>
|
||||
A free function as a completion handler:
|
||||
</p>
|
||||
<pre class="programlisting">void completion_handler()
|
||||
{
|
||||
...
|
||||
}
|
||||
</pre>
|
||||
<p>
|
||||
A completion handler function object:
|
||||
</p>
|
||||
<pre class="programlisting">struct completion_handler
|
||||
{
|
||||
...
|
||||
void operator()()
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
};
|
||||
</pre>
|
||||
<p>
|
||||
A lambda as a completion handler:
|
||||
</p>
|
||||
<pre class="programlisting">my_io_service.post(
|
||||
[]()
|
||||
{
|
||||
...
|
||||
});
|
||||
</pre>
|
||||
<p>
|
||||
A non-static class member function adapted to a completion handler using
|
||||
<code class="computeroutput">std::bind()</code>:
|
||||
</p>
|
||||
<pre class="programlisting">void my_class::completion_handler()
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
my_io_service.post(std::bind(&my_class::completion_handler, this));
|
||||
</pre>
|
||||
<p>
|
||||
A non-static class member function adapted to a completion handler using
|
||||
<code class="computeroutput">boost::bind()</code>:
|
||||
</p>
|
||||
<pre class="programlisting">void my_class::completion_handler()
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
my_io_service.post(boost::bind(&my_class::completion_handler, this));
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="IteratorConnectHandler.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="MoveAcceptHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,97 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Move accept handler requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="LegacyCompletionHandler.html" title="Legacy completion handler requirements">
|
||||
<link rel="next" href="MutableBufferSequence.html" title="Mutable buffer sequence requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="LegacyCompletionHandler.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="MutableBufferSequence.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.MoveAcceptHandler"></a><a class="link" href="MoveAcceptHandler.html" title="Move accept handler requirements">Move accept handler
|
||||
requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A move accept handler must meet the requirements for a <a class="link" href="Handler.html" title="Handlers">handler</a>.
|
||||
A value <code class="computeroutput">h</code> of a move accept handler class should work correctly
|
||||
in the expression <code class="computeroutput">h(ec, s)</code>, where <code class="computeroutput">ec</code> is an lvalue
|
||||
of type <code class="computeroutput">const error_code</code> and <code class="computeroutput">s</code> is an lvalue of
|
||||
the nested type <code class="computeroutput">Protocol::socket</code> for the type <code class="computeroutput">Protocol</code>
|
||||
of the socket class template.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="asio.reference.MoveAcceptHandler.h0"></a>
|
||||
<span><a name="asio.reference.MoveAcceptHandler.examples"></a></span><a class="link" href="MoveAcceptHandler.html#asio.reference.MoveAcceptHandler.examples">Examples</a>
|
||||
</h5>
|
||||
<p>
|
||||
A free function as a move accept handler:
|
||||
</p>
|
||||
<pre class="programlisting">void accept_handler(
|
||||
const asio::error_code& ec, asio::ip::tcp::socket s)
|
||||
{
|
||||
...
|
||||
}
|
||||
</pre>
|
||||
<p>
|
||||
A move accept handler function object:
|
||||
</p>
|
||||
<pre class="programlisting">struct accept_handler
|
||||
{
|
||||
...
|
||||
void operator()(
|
||||
const asio::error_code& ec, asio::ip::tcp::socket s)
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
};
|
||||
</pre>
|
||||
<p>
|
||||
A lambda as a move accept handler:
|
||||
</p>
|
||||
<pre class="programlisting">acceptor.async_accept(...,
|
||||
[](const asio::error_code& ec, asio::ip::tcp::socket s)
|
||||
{
|
||||
...
|
||||
});
|
||||
</pre>
|
||||
<p>
|
||||
A non-static class member function adapted to a move accept handler using
|
||||
<code class="computeroutput">std::bind()</code>:
|
||||
</p>
|
||||
<pre class="programlisting">void my_class::accept_handler(
|
||||
const asio::error_code& ec, asio::ip::tcp::socket socket)
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
asio::async_accept(...,
|
||||
std::bind(&my_class::accept_handler,
|
||||
this, std::placeholders::_1,
|
||||
std::placeholders::_2));
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="LegacyCompletionHandler.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="MutableBufferSequence.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,130 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Mutable buffer sequence requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="MoveAcceptHandler.html" title="Move accept handler requirements">
|
||||
<link rel="next" href="OperationState.html" title="Operation state concept">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="MoveAcceptHandler.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="OperationState.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.MutableBufferSequence"></a><a class="link" href="MutableBufferSequence.html" title="Mutable buffer sequence requirements">Mutable buffer
|
||||
sequence requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A <span class="emphasis"><em>mutable buffer sequence</em></span> represents a set of memory
|
||||
regions that may be used to receive the output of an operation, such as the
|
||||
<code class="computeroutput">receive</code> operation of a socket.
|
||||
</p>
|
||||
<p>
|
||||
A type <code class="computeroutput">X</code> meets the <code class="computeroutput">MutableBufferSequence</code> requirements
|
||||
if it satisfies the requirements of <code class="computeroutput">Destructible</code> (C++Std [destructible])
|
||||
and <code class="computeroutput">CopyConstructible</code> (C++Std [copyconstructible]), as well
|
||||
as the additional requirements listed below.
|
||||
</p>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput">x</code> denotes a (possibly const) value of type
|
||||
<code class="computeroutput">X</code>, and <code class="computeroutput">u</code> denotes an identifier.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.MutableBufferSequence.t0"></a><p class="title"><b>Table 22. MutableBufferSequence requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="MutableBufferSequence requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
return type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-condition
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">asio::buffer_sequence_begin(x)</code><br> <code class="computeroutput">asio::buffer_sequence_end(x)</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
An iterator type meeting the requirements for bidirectional iterators
|
||||
(C++Std [bidirectional.iterators]) whose value type is convertible
|
||||
to <code class="computeroutput">mutable_buffer</code>.
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
</p>
|
||||
<pre class="programlisting">X u(x);
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
post:<br>
|
||||
</p>
|
||||
<pre class="programlisting">equal(
|
||||
asio::buffer_sequence_begin(x),
|
||||
asio::buffer_sequence_end(x),
|
||||
asio::buffer_sequence_begin(u),
|
||||
asio::buffer_sequence_end(u),
|
||||
[](const mutable_buffer& b1,
|
||||
const mutable_buffer& b2)
|
||||
{
|
||||
return b1.data() == b2.data()
|
||||
&& b1.size() == b2.size();
|
||||
})
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="MoveAcceptHandler.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="OperationState.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,66 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Operation state concept</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="MutableBufferSequence.html" title="Mutable buffer sequence requirements">
|
||||
<link rel="next" href="ProtoAllocator.html" title="Proto-allocator requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="MutableBufferSequence.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="ProtoAllocator.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.OperationState"></a><a class="link" href="OperationState.html" title="Operation state concept">Operation state concept</a>
|
||||
</h3></div></div></div>
|
||||
<pre class="programlisting">template<class O>
|
||||
concept operation_state =
|
||||
destructible<O> &&
|
||||
is_object_v<O> &&
|
||||
requires (O& o) {
|
||||
{ execution::start(o) } noexcept;
|
||||
};
|
||||
</pre>
|
||||
<p>
|
||||
An object whose type satisfies <code class="computeroutput">operation_state</code> represents the
|
||||
state of an asynchronous operation. It is the result of calling <code class="computeroutput">execution::connect</code>
|
||||
with a <code class="computeroutput">sender</code> and a <code class="computeroutput">receiver</code>.
|
||||
</p>
|
||||
<p>
|
||||
<code class="computeroutput">execution::start</code> may be called on an <code class="computeroutput">operation_state</code>
|
||||
object at most once. Once <code class="computeroutput">execution::start</code> has been invoked,
|
||||
the caller shall ensure that the start of a non-exceptional invocation of
|
||||
one of the receiver's completion-signalling operations strongly happens before
|
||||
[intro.multithread] the call to the <code class="computeroutput">operation_state</code> destructor.
|
||||
</p>
|
||||
<p>
|
||||
The start of the invocation of <code class="computeroutput">execution::start</code> shall strongly
|
||||
happen before [intro.multithread] the invocation of one of the three receiver
|
||||
operations.
|
||||
</p>
|
||||
<p>
|
||||
<code class="computeroutput">execution::start</code> may or may not block pending the successful
|
||||
transfer of execution to one of the three receiver operations.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="MutableBufferSequence.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="ProtoAllocator.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,48 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Proto-allocator requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="OperationState.html" title="Operation state concept">
|
||||
<link rel="next" href="Protocol.html" title="Protocol requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="OperationState.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="Protocol.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.ProtoAllocator"></a><a class="link" href="ProtoAllocator.html" title="Proto-allocator requirements">Proto-allocator requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A type <code class="computeroutput">A</code> meets the proto-allocator requirements if <code class="computeroutput">A</code>
|
||||
is <code class="computeroutput">CopyConstructible</code> (C++Std [copyconstructible]), <code class="computeroutput">Destructible</code>
|
||||
(C++Std [destructible]), and <code class="computeroutput">allocator_traits<A>::rebind_alloc<U></code>
|
||||
meets the allocator requirements (C++Std [allocator.requirements]), where
|
||||
<code class="computeroutput">U</code> is an object type. [<span class="emphasis"><em>Note:</em></span> For example,
|
||||
<code class="computeroutput">std::allocator<void></code> meets the proto-allocator requirements
|
||||
but not the allocator requirements. —<span class="emphasis"><em>end note</em></span>] No constructor,
|
||||
comparison operator, copy operation, move operation, or swap operation on
|
||||
these types shall exit via an exception.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="OperationState.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="Protocol.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,180 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Protocol requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="ProtoAllocator.html" title="Proto-allocator requirements">
|
||||
<link rel="next" href="RangeConnectHandler.html" title="Range connect handler requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="ProtoAllocator.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="RangeConnectHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.Protocol"></a><a class="link" href="Protocol.html" title="Protocol requirements">Protocol requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A type <code class="computeroutput">X</code> meets the <code class="computeroutput">Protocol</code> requirements if it
|
||||
satisfies the requirements of <code class="computeroutput">Destructible</code> (C++Std [destructible]),
|
||||
<code class="computeroutput">CopyConstructible</code> (C++Std [copyconstructible]), and <code class="computeroutput">CopyAssignable</code>
|
||||
(C++Std [copyassignable]), as well as the additional requirements listed
|
||||
below.
|
||||
</p>
|
||||
<p>
|
||||
No copy or move operation of the type <code class="computeroutput">X</code> shall exit via an exception.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.Protocol.t0"></a><p class="title"><b>Table 23. Protocol requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Protocol requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
return type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-conditions
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody><tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">X::endpoint</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
type meeting <a class="link" href="Endpoint.html" title="Endpoint requirements">endpoint</a>
|
||||
requirements
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break"><p>
|
||||
In the table below, <code class="computeroutput">a</code> denotes a (possibly const) value of type
|
||||
<code class="computeroutput">X</code>.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.Protocol.t1"></a><p class="title"><b>Table 24. Protocol requirements for extensible implementations</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Protocol requirements for extensible implementations">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
return type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-conditions
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">a.family()</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">int</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a value suitable for passing as the <span class="emphasis"><em>domain</em></span>
|
||||
argument to <span class="emphasis"><em>POSIX</em></span> <a href="http://www.opengroup.org/onlinepubs/9699919799/functions/socket.html" target="_top"><code class="computeroutput"><span class="identifier">socket</span><span class="special">()</span></code></a>
|
||||
(or equivalent).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">a.type()</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">int</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a value suitable for passing as the <span class="emphasis"><em>type</em></span>
|
||||
argument to <span class="emphasis"><em>POSIX</em></span> <a href="http://www.opengroup.org/onlinepubs/9699919799/functions/socket.html" target="_top"><code class="computeroutput"><span class="identifier">socket</span><span class="special">()</span></code></a>
|
||||
(or equivalent).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">a.protocol()</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">int</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a value suitable for passing as the <span class="emphasis"><em>protocol</em></span>
|
||||
argument to <span class="emphasis"><em>POSIX</em></span> <a href="http://www.opengroup.org/onlinepubs/9699919799/functions/socket.html" target="_top"><code class="computeroutput"><span class="identifier">socket</span><span class="special">()</span></code></a>
|
||||
(or equivalent).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="ProtoAllocator.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="RangeConnectHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,118 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Range connect handler requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="Protocol.html" title="Protocol requirements">
|
||||
<link rel="next" href="ReadHandler.html" title="Read handler requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="Protocol.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="ReadHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.RangeConnectHandler"></a><a class="link" href="RangeConnectHandler.html" title="Range connect handler requirements">Range connect handler
|
||||
requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A range connect handler must meet the requirements for a <a class="link" href="Handler.html" title="Handlers">handler</a>.
|
||||
A value <code class="computeroutput">h</code> of a range connect handler class should work correctly
|
||||
in the expression <code class="computeroutput">h(ec, ep)</code>, where <code class="computeroutput">ec</code> is an lvalue
|
||||
of type <code class="computeroutput">const error_code</code> and <code class="computeroutput">ep</code> is an lvalue of
|
||||
the type <code class="computeroutput">Protocol::endpoint</code> for the <code class="computeroutput">Protocol</code> type
|
||||
in the corresponding <code class="computeroutput">connect()</code> or async_connect()` function.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="asio.reference.RangeConnectHandler.h0"></a>
|
||||
<span><a name="asio.reference.RangeConnectHandler.examples"></a></span><a class="link" href="RangeConnectHandler.html#asio.reference.RangeConnectHandler.examples">Examples</a>
|
||||
</h5>
|
||||
<p>
|
||||
A free function as a range connect handler:
|
||||
</p>
|
||||
<pre class="programlisting">void connect_handler(
|
||||
const asio::error_code& ec,
|
||||
const asio::ip::tcp::endpoint& endpoint)
|
||||
{
|
||||
...
|
||||
}
|
||||
</pre>
|
||||
<p>
|
||||
A range connect handler function object:
|
||||
</p>
|
||||
<pre class="programlisting">struct connect_handler
|
||||
{
|
||||
...
|
||||
template <typename Range>
|
||||
void operator()(
|
||||
const asio::error_code& ec,
|
||||
const asio::ip::tcp::endpoint& endpoint)
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
};
|
||||
</pre>
|
||||
<p>
|
||||
A lambda as a range connect handler:
|
||||
</p>
|
||||
<pre class="programlisting">asio::async_connect(...,
|
||||
[](const asio::error_code& ec,
|
||||
const asio::ip::tcp::endpoint& endpoint)
|
||||
{
|
||||
...
|
||||
});
|
||||
</pre>
|
||||
<p>
|
||||
A non-static class member function adapted to a range connect handler using
|
||||
<code class="computeroutput">std::bind()</code>:
|
||||
</p>
|
||||
<pre class="programlisting">void my_class::connect_handler(
|
||||
const asio::error_code& ec,
|
||||
const asio::ip::tcp::endpoint& endpoint)
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
asio::async_connect(...,
|
||||
std::bind(&my_class::connect_handler,
|
||||
this, std::placeholders::_1,
|
||||
std::placeholders::_2));
|
||||
</pre>
|
||||
<p>
|
||||
A non-static class member function adapted to a range connect handler using
|
||||
<code class="computeroutput">boost::bind()</code>:
|
||||
</p>
|
||||
<pre class="programlisting">void my_class::connect_handler(
|
||||
const asio::error_code& ec,
|
||||
const asio::ip::tcp::endpoint& endpoint)
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
asio::async_connect(...,
|
||||
boost::bind(&my_class::connect_handler,
|
||||
this, asio::placeholders::error,
|
||||
asio::placeholders::endpoint));
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="Protocol.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="ReadHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,113 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Read handler requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="RangeConnectHandler.html" title="Range connect handler requirements">
|
||||
<link rel="next" href="Receiver.html" title="Receiver concepts">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="RangeConnectHandler.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="Receiver.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.ReadHandler"></a><a class="link" href="ReadHandler.html" title="Read handler requirements">Read handler requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A read handler must meet the requirements for a <a class="link" href="Handler.html" title="Handlers">handler</a>.
|
||||
A value <code class="computeroutput">h</code> of a read handler class should work correctly in the
|
||||
expression <code class="computeroutput">h(ec, s)</code>, where <code class="computeroutput">ec</code> is an lvalue of type
|
||||
<code class="computeroutput">const error_code</code> and <code class="computeroutput">s</code> is an lvalue of type <code class="computeroutput">const
|
||||
size_t</code>.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="asio.reference.ReadHandler.h0"></a>
|
||||
<span><a name="asio.reference.ReadHandler.examples"></a></span><a class="link" href="ReadHandler.html#asio.reference.ReadHandler.examples">Examples</a>
|
||||
</h5>
|
||||
<p>
|
||||
A free function as a read handler:
|
||||
</p>
|
||||
<pre class="programlisting">void read_handler(
|
||||
const asio::error_code& ec,
|
||||
std::size_t bytes_transferred)
|
||||
{
|
||||
...
|
||||
}
|
||||
</pre>
|
||||
<p>
|
||||
A read handler function object:
|
||||
</p>
|
||||
<pre class="programlisting">struct read_handler
|
||||
{
|
||||
...
|
||||
void operator()(
|
||||
const asio::error_code& ec,
|
||||
std::size_t bytes_transferred)
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
};
|
||||
</pre>
|
||||
<p>
|
||||
A lambda as a read handler:
|
||||
</p>
|
||||
<pre class="programlisting">socket.async_read(...
|
||||
[](const asio::error_code& ec,
|
||||
std::size_t bytes_transferred)
|
||||
{
|
||||
...
|
||||
});
|
||||
</pre>
|
||||
<p>
|
||||
A non-static class member function adapted to a read handler using <code class="computeroutput">std::bind()</code>:
|
||||
</p>
|
||||
<pre class="programlisting">void my_class::read_handler(
|
||||
const asio::error_code& ec,
|
||||
std::size_t bytes_transferred)
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
socket.async_read(...,
|
||||
std::bind(&my_class::read_handler,
|
||||
this, std::placeholders::_1,
|
||||
std::placeholders::_2));
|
||||
</pre>
|
||||
<p>
|
||||
A non-static class member function adapted to a read handler using <code class="computeroutput">boost::bind()</code>:
|
||||
</p>
|
||||
<pre class="programlisting">void my_class::read_handler(
|
||||
const asio::error_code& ec,
|
||||
std::size_t bytes_transferred)
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
socket.async_read(...,
|
||||
boost::bind(&my_class::read_handler,
|
||||
this, asio::placeholders::error,
|
||||
asio::placeholders::bytes_transferred));
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="RangeConnectHandler.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="Receiver.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,88 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Receiver concepts</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="ReadHandler.html" title="Read handler requirements">
|
||||
<link rel="next" href="ResolveHandler.html" title="Resolve handler requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="ReadHandler.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="ResolveHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.Receiver"></a><a class="link" href="Receiver.html" title="Receiver concepts">Receiver concepts</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A receiver represents the continuation of an asynchronous operation. An asynchronous
|
||||
operation may complete with a (possibly empty) set of values, an error, or
|
||||
it may be cancelled. A receiver has three principal operations corresponding
|
||||
to the three ways an asynchronous operation may complete: <code class="computeroutput">set_value</code>,
|
||||
<code class="computeroutput">set_error</code>, and <code class="computeroutput">set_done</code>. These are collectively
|
||||
known as a receiver’s <span class="emphasis"><em>completion-signal operations</em></span>.
|
||||
</p>
|
||||
<pre class="programlisting">template<class T, class E = exception_ptr>
|
||||
concept receiver =
|
||||
move_constructible<remove_cvref_t<T>> &&
|
||||
constructible_from<remove_cvref_t<T>, T> &&
|
||||
requires(remove_cvref_t<T>&& t, E&& e) {
|
||||
{ execution::set_done(std::move(t)) } noexcept;
|
||||
{ execution::set_error(std::move(t), (E&&) e) } noexcept;
|
||||
};
|
||||
|
||||
template<class T, class... An>
|
||||
concept receiver_of =
|
||||
receiver<T> &&
|
||||
requires(remove_cvref_t<T>&& t, An&&... an) {
|
||||
execution::set_value(std::move(t), (An&&) an...);
|
||||
};
|
||||
</pre>
|
||||
<p>
|
||||
The receiver’s completion-signal operations have semantic requirements
|
||||
that are collectively known as the <span class="emphasis"><em>receiver contract</em></span>,
|
||||
described below:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
None of a receiver’s completion-signal operations shall be invoked
|
||||
before <code class="computeroutput">execution::start</code> has been called on the operation
|
||||
state object that was returned by <code class="computeroutput">execution::connect</code> to
|
||||
connect that receiver to a sender.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Once <code class="computeroutput">execution::start</code> has been called on the operation state
|
||||
object, exactly one of the receiver’s completion-signal operations
|
||||
shall complete non-exceptionally before the receiver is destroyed.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
If <code class="computeroutput">execution::set_value</code> exits with an exception, it is still
|
||||
valid to call <code class="computeroutput">execution::set_error</code> or <code class="computeroutput">execution::set_done</code>
|
||||
on the receiver.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
Once one of a receiver’s completion-signal operations has completed non-exceptionally,
|
||||
the receiver contract has been satisfied.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="ReadHandler.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="ResolveHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,115 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Resolve handler requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="Receiver.html" title="Receiver concepts">
|
||||
<link rel="next" href="Scheduler.html" title="Scheduler concept">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="Receiver.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="Scheduler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.ResolveHandler"></a><a class="link" href="ResolveHandler.html" title="Resolve handler requirements">Resolve handler requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A resolve handler must meet the requirements for a <a class="link" href="Handler.html" title="Handlers">handler</a>.
|
||||
A value <code class="computeroutput">h</code> of a resolve handler class should work correctly in
|
||||
the expression <code class="computeroutput">h(ec, r)</code>, where <code class="computeroutput">ec</code> is an lvalue
|
||||
of type <code class="computeroutput">const error_code</code> and <code class="computeroutput">r</code> is an lvalue of
|
||||
type <code class="computeroutput">const ip::basic_resolver_results<InternetProtocol></code>.
|
||||
<code class="computeroutput">InternetProtocol</code> is the template parameter of the <a class="link" href="ip__basic_resolver.html" title="ip::basic_resolver"><code class="computeroutput">ip::basic_resolver<></code></a>
|
||||
which is used to initiate the asynchronous operation.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="asio.reference.ResolveHandler.h0"></a>
|
||||
<span><a name="asio.reference.ResolveHandler.examples"></a></span><a class="link" href="ResolveHandler.html#asio.reference.ResolveHandler.examples">Examples</a>
|
||||
</h5>
|
||||
<p>
|
||||
A free function as a resolve handler:
|
||||
</p>
|
||||
<pre class="programlisting">void resolve_handler(
|
||||
const asio::error_code& ec,
|
||||
asio::ip::tcp::resolver::results_type results)
|
||||
{
|
||||
...
|
||||
}
|
||||
</pre>
|
||||
<p>
|
||||
A resolve handler function object:
|
||||
</p>
|
||||
<pre class="programlisting">struct resolve_handler
|
||||
{
|
||||
...
|
||||
void operator()(
|
||||
const asio::error_code& ec,
|
||||
asio::ip::tcp::resolver::results_type results)
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
};
|
||||
</pre>
|
||||
<p>
|
||||
A lambda as a resolve handler:
|
||||
</p>
|
||||
<pre class="programlisting">resolver.async_resolve(...,
|
||||
[](const asio::error_code& ec,
|
||||
asio::ip::tcp::resolver::results_type results)
|
||||
{
|
||||
...
|
||||
});
|
||||
</pre>
|
||||
<p>
|
||||
A non-static class member function adapted to a resolve handler using <code class="computeroutput">std::bind()</code>:
|
||||
</p>
|
||||
<pre class="programlisting">void my_class::resolve_handler(
|
||||
const asio::error_code& ec,
|
||||
asio::ip::tcp::resolver::results_type results)
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
resolver.async_resolve(...,
|
||||
std::bind(&my_class::resolve_handler,
|
||||
this, std::placeholders::_1,
|
||||
std::placeholders::_2));
|
||||
</pre>
|
||||
<p>
|
||||
A non-static class member function adapted to a resolve handler using <code class="computeroutput">boost::bind()</code>:
|
||||
</p>
|
||||
<pre class="programlisting">void my_class::resolve_handler(
|
||||
const asio::error_code& ec,
|
||||
asio::ip::tcp::resolver::results_type results)
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
resolver.async_resolve(...,
|
||||
boost::bind(&my_class::resolve_handler,
|
||||
this, asio::placeholders::error,
|
||||
asio::placeholders::results));
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="Receiver.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="Scheduler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,178 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Scheduler concept</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="ResolveHandler.html" title="Resolve handler requirements">
|
||||
<link rel="next" href="Sender.html" title="Sender concepts">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="ResolveHandler.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="Sender.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.Scheduler"></a><a class="link" href="Scheduler.html" title="Scheduler concept">Scheduler concept</a>
|
||||
</h3></div></div></div>
|
||||
<pre class="programlisting">template<class S>
|
||||
concept scheduler =
|
||||
copy_constructible<remove_cvref_t<S>> &&
|
||||
equality_comparable<remove_cvref_t<S>> &&
|
||||
requires(E&& e) {
|
||||
execution::schedule((E&&)e);
|
||||
};
|
||||
</pre>
|
||||
<p>
|
||||
None of a scheduler's copy constructor, destructor, equality comparison,
|
||||
or <code class="computeroutput">swap</code> operation shall exit via an exception.
|
||||
</p>
|
||||
<p>
|
||||
None of these operations, nor a scheduler type's <code class="computeroutput">schedule</code> function,
|
||||
or associated query functions shall introduce data races as a result of concurrent
|
||||
invocations of those functions from different threads.
|
||||
</p>
|
||||
<p>
|
||||
For any two (possibly const) values <code class="computeroutput">x1</code> and <code class="computeroutput">x2</code> of
|
||||
some scheduler type <code class="computeroutput">X</code>, <code class="computeroutput">x1 == x2</code> shall return <code class="computeroutput">true</code>
|
||||
only if <code class="computeroutput">asio::query(x1, p) == asio::query(x2, p)</code> for every property
|
||||
<code class="computeroutput">p</code> where both <code class="computeroutput">asio::query(x1, p)</code> and <code class="computeroutput">asio::query(x2,
|
||||
p)</code> are well-formed and result in a non-void type that is <code class="computeroutput">EqualityComparable</code>
|
||||
(C++Std [equalitycomparable]). [<span class="emphasis"><em>Note:</em></span> The above requirements
|
||||
imply that <code class="computeroutput">x1 == x2</code> returns <code class="computeroutput">true</code> if <code class="computeroutput">x1</code>
|
||||
and <code class="computeroutput">x2</code> can be interchanged with identical effects. A scheduler
|
||||
may conceptually contain additional properties which are not exposed by a
|
||||
named property type that can be observed via <code class="computeroutput">asio::query</code>; in
|
||||
this case, it is up to the concrete scheduler implementation to decide if
|
||||
these properties affect equality. Returning <code class="computeroutput">false</code> does not necessarily
|
||||
imply that the effects are not identical. —<span class="emphasis"><em>end note</em></span>]
|
||||
</p>
|
||||
<p>
|
||||
A scheduler type's destructor shall not block pending completion of any receivers
|
||||
submitted to the sender objects returned from <code class="computeroutput">schedule</code>. [<span class="emphasis"><em>Note:</em></span>
|
||||
The ability to wait for completion of submitted function objects may be provided
|
||||
by the execution context that produced the scheduler. —<span class="emphasis"><em>end note</em></span>]
|
||||
</p>
|
||||
<p>
|
||||
In addition to the above requirements, type <code class="computeroutput">S</code> models <code class="computeroutput">scheduler</code>
|
||||
only if it satisfies the requirements in the Table below.
|
||||
</p>
|
||||
<p>
|
||||
In the Table below,
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
<code class="computeroutput">s</code> denotes a (possibly const) scheduler object of type <code class="computeroutput">S</code>,
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<code class="computeroutput">N</code> denotes a type that models <code class="computeroutput">sender</code>, and
|
||||
</li>
|
||||
<li class="listitem">
|
||||
<code class="computeroutput">n</code> denotes a sender object of type <code class="computeroutput">N</code>
|
||||
</li>
|
||||
</ul></div>
|
||||
<div class="table">
|
||||
<a name="asio.reference.Scheduler.t0"></a><p class="title"><b>Table 25. Scheduler requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Scheduler requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
return type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
operation semantics
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody><tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">execution::schedule(s)</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">N</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Evaluates <code class="computeroutput">execution::schedule(s)</code> on the calling thread
|
||||
to create <code class="computeroutput">N</code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break"><p>
|
||||
<code class="computeroutput">execution::start(o)</code>, where <code class="computeroutput">o</code> is the result of a
|
||||
call to <code class="computeroutput">execution::connect(N, r)</code> for some receiver object <code class="computeroutput">r</code>,
|
||||
is required to eagerly submit <code class="computeroutput">r</code> for execution on an execution
|
||||
agent that <code class="computeroutput">s</code> creates for it. Let <code class="computeroutput">rc</code> be <code class="computeroutput">r</code>
|
||||
or an object created by copy or move construction from <code class="computeroutput">r</code>. The
|
||||
semantic constraints on the <code class="computeroutput">sender</code> <code class="computeroutput">N</code> returned from
|
||||
a scheduler <code class="computeroutput">s</code>'s <code class="computeroutput">schedule</code> function are as follows:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
If <code class="computeroutput">rc</code>'s <code class="computeroutput">set_error</code> function is called in response
|
||||
to a submission error, scheduling error, or other internal error, let
|
||||
<code class="computeroutput">E</code> be an expression that refers to that error if <code class="computeroutput">set_error(rc,
|
||||
E)</code> is well-formed; otherwise, let <code class="computeroutput">E</code> be an <code class="computeroutput">exception_ptr</code>
|
||||
that refers to that error. [Note: <code class="computeroutput">E</code> could be the result
|
||||
of calling <code class="computeroutput">current_exception</code> or <code class="computeroutput">make_exception_ptr</code>.]
|
||||
The scheduler calls <code class="computeroutput">set_error(rc, E)</code> on an unspecified weakly-parallel
|
||||
execution agent ([Note: An invocation of <code class="computeroutput">set_error</code> on a
|
||||
receiver is required to be <code class="computeroutput">noexcept</code>]), and
|
||||
</li>
|
||||
<li class="listitem">
|
||||
If <code class="computeroutput">rc</code>'s <code class="computeroutput">set_error</code> function is called in response
|
||||
to an exception that propagates out of the invocation of <code class="computeroutput">set_value</code>
|
||||
on <code class="computeroutput">rc</code>, let <code class="computeroutput">E</code> be <code class="computeroutput">make_exception_ptr(receiver_invocation_error{})</code>
|
||||
invoked from within a catch clause that has caught the exception. The
|
||||
executor calls <code class="computeroutput">set_error(rc, E)</code> on an unspecified weakly-parallel
|
||||
execution agent, and
|
||||
</li>
|
||||
<li class="listitem">
|
||||
A call to <code class="computeroutput">set_done(rc)</code> is made on an unspecified weakly-parallel
|
||||
execution agent ([Note: An invocation of a receiver's <code class="computeroutput">set_done</code>
|
||||
function is required to be <code class="computeroutput">noexcept</code>]).
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
[<span class="emphasis"><em>Note:</em></span> The senders returned from a scheduler's <code class="computeroutput">schedule</code>
|
||||
function have wide discretion when deciding which of the three receiver functions
|
||||
to call upon submission. —<span class="emphasis"><em>end note</em></span>]
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="ResolveHandler.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="Sender.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,98 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Sender concepts</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="Scheduler.html" title="Scheduler concept">
|
||||
<link rel="next" href="Service.html" title="Service requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="Scheduler.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="Service.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.Sender"></a><a class="link" href="Sender.html" title="Sender concepts">Sender concepts</a>
|
||||
</h3></div></div></div>
|
||||
<h5>
|
||||
<a name="asio.reference.Sender.h0"></a>
|
||||
<span><a name="asio.reference.Sender.sender_and_sender_to"></a></span><a class="link" href="Sender.html#asio.reference.Sender.sender_and_sender_to">sender
|
||||
and sender_to</a>
|
||||
</h5>
|
||||
<pre class="programlisting">template<class S>
|
||||
concept sender =
|
||||
move_constructible<remove_cvref_t<S>> &&
|
||||
!requires {
|
||||
typename sender_traits<remove_cvref_t<S>>::__unspecialized; // exposition only
|
||||
};
|
||||
|
||||
template<class S, class R>
|
||||
concept sender_to =
|
||||
sender<S> &&
|
||||
receiver<R> &&
|
||||
requires (S&& s, R&& r) {
|
||||
execution::connect((S&&) s, (R&&) r);
|
||||
};
|
||||
</pre>
|
||||
<p>
|
||||
None of these operations shall introduce data races as a result of concurrent
|
||||
invocations of those functions from different threads.
|
||||
</p>
|
||||
<p>
|
||||
A sender type's destructor shall not block pending completion of the submitted
|
||||
function objects.
|
||||
</p>
|
||||
<p>
|
||||
[<span class="emphasis"><em>Note:</em></span> The ability to wait for completion of submitted
|
||||
function objects may be provided by the associated execution context. —<span class="emphasis"><em>end
|
||||
note</em></span>]
|
||||
</p>
|
||||
<h5>
|
||||
<a name="asio.reference.Sender.h1"></a>
|
||||
<span><a name="asio.reference.Sender.typed_sender"></a></span><a class="link" href="Sender.html#asio.reference.Sender.typed_sender">typed_sender</a>
|
||||
</h5>
|
||||
<p>
|
||||
A sender is <span class="bold"><strong>typed</strong></span> if it declares what types
|
||||
it sends through a receiver's channels. The <code class="computeroutput">typed_sender</code> concept
|
||||
is defined as:
|
||||
</p>
|
||||
<pre class="programlisting">template<template<template<class...> class Tuple, template<class...> class Variant> class>
|
||||
struct has-value-types; // exposition only
|
||||
|
||||
template<template<class...> class Variant>
|
||||
struct has-error-types; // exposition only
|
||||
|
||||
template<class S>
|
||||
concept has-sender-types = // exposition only
|
||||
requires {
|
||||
typename has-value-types<S::template value_types>;
|
||||
typename has-error-types<S::template error_types>;
|
||||
typename bool_constant<S::sends_done>;
|
||||
};
|
||||
|
||||
template<class S>
|
||||
concept typed_sender =
|
||||
sender<S> &&
|
||||
has-sender-types<sender_traits<remove_cvref_t<S>>>;
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="Scheduler.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="Service.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,74 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Service requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="Sender.html" title="Sender concepts">
|
||||
<link rel="next" href="SettableSerialPortOption.html" title="Settable serial port option requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="Sender.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="SettableSerialPortOption.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.Service"></a><a class="link" href="Service.html" title="Service requirements">Service requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A class is a <span class="emphasis"><em>service</em></span> if it is publicly and unambiguously
|
||||
derived from <code class="computeroutput">execution_context::service</code>, or if it is publicly
|
||||
and unambiguously derived from another service. For a service <code class="computeroutput">S</code>,
|
||||
<code class="computeroutput">S::key_type</code> shall be valid and denote a type (C++Std [temp.deduct]),
|
||||
<code class="computeroutput">is_base_of_v<typename S::key_type, S></code> shall be <code class="computeroutput">true</code>,
|
||||
and <code class="computeroutput">S</code> shall satisfy the <code class="computeroutput">Destructible</code> requirements
|
||||
(C++Std [destructible]).
|
||||
</p>
|
||||
<p>
|
||||
The first parameter of all service constructors shall be an lvalue reference
|
||||
to <code class="computeroutput">execution_context</code>. This parameter denotes the <code class="computeroutput">execution_context</code>
|
||||
object that represents a set of services, of which the service object will
|
||||
be a member. [<span class="emphasis"><em>Note:</em></span> These constructors may be called
|
||||
by the <code class="computeroutput">make_service</code> function. —<span class="emphasis"><em>end note</em></span>]
|
||||
</p>
|
||||
<p>
|
||||
A service shall provide an explicit constructor with a single parameter of
|
||||
lvalue reference to <code class="computeroutput">execution_context</code>. [<span class="emphasis"><em>Note:</em></span>
|
||||
This constructor may be called by the <code class="computeroutput">use_service</code> function.
|
||||
—<span class="emphasis"><em>end note</em></span>]
|
||||
</p>
|
||||
<pre class="programlisting">class my_service : public execution_context::service
|
||||
{
|
||||
public:
|
||||
typedef my_service key_type;
|
||||
explicit my_service(execution_context& ctx);
|
||||
my_service(execution_context& ctx, int some_value);
|
||||
private:
|
||||
virtual void shutdown() noexcept override;
|
||||
...
|
||||
};
|
||||
</pre>
|
||||
<p>
|
||||
A service's <code class="computeroutput">shutdown</code> member function shall destroy all copies
|
||||
of user-defined function objects that are held by the service.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="Sender.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="SettableSerialPortOption.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,94 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Settable serial port option requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="Service.html" title="Service requirements">
|
||||
<link rel="next" href="SettableSocketOption.html" title="Settable socket option requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="Service.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="SettableSocketOption.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.SettableSerialPortOption"></a><a class="link" href="SettableSerialPortOption.html" title="Settable serial port option requirements">Settable serial
|
||||
port option requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput">X</code> denotes a serial port option class, <code class="computeroutput">a</code>
|
||||
denotes a value of <code class="computeroutput">X</code>, <code class="computeroutput">ec</code> denotes a value of type
|
||||
<code class="computeroutput">error_code</code>, and <code class="computeroutput">s</code> denotes a value of implementation-defined
|
||||
type <span class="emphasis"><em><code class="literal">storage</code></em></span> (where <span class="emphasis"><em><code class="literal">storage</code></em></span>
|
||||
is the type <code class="computeroutput">DCB</code> on Windows and <code class="computeroutput">termios</code> on <span class="emphasis"><em>POSIX</em></span>
|
||||
platforms), and <code class="computeroutput">u</code> denotes an identifier.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.SettableSerialPortOption.t0"></a><p class="title"><b>Table 26. SettableSerialPortOption requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="SettableSerialPortOption requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-conditions
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody><tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">const X& u = a;</code><br> <code class="computeroutput">u.store(s, ec);</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">error_code</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Saves the value of the serial port option to the storage.<br>
|
||||
<br> If successful, sets <code class="computeroutput">ec</code> such that <code class="computeroutput">!ec</code>
|
||||
is true. If an error occurred, sets <code class="computeroutput">ec</code> such that
|
||||
<code class="computeroutput">!!ec</code> is true. Returns <code class="computeroutput">ec</code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="Service.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="SettableSocketOption.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,155 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Settable socket option requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="SettableSerialPortOption.html" title="Settable serial port option requirements">
|
||||
<link rel="next" href="ShutdownHandler.html" title="SSL shutdown handler requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="SettableSerialPortOption.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="ShutdownHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.SettableSocketOption"></a><a class="link" href="SettableSocketOption.html" title="Settable socket option requirements">Settable socket
|
||||
option requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A type <code class="computeroutput">X</code> meets the <code class="computeroutput">SettableSocketOption</code> requirements
|
||||
if it satisfies the requirements listed below.
|
||||
</p>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput">a</code> denotes a (possibly const) value of type
|
||||
<code class="computeroutput">X</code>, <code class="computeroutput">p</code> denotes a (possibly const) value that meets
|
||||
the <a class="link" href="Protocol.html" title="Protocol requirements"><code class="computeroutput">Protocol</code></a>
|
||||
requirements, and <code class="computeroutput">u</code> denotes an identifier.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.SettableSocketOption.t0"></a><p class="title"><b>Table 27. SettableSocketOption requirements for extensible implementations</b></p>
|
||||
<div class="table-contents"><table class="table" summary="SettableSocketOption requirements for extensible implementations">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-conditions
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">a.level(p)</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">int</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a value suitable for passing as the <span class="emphasis"><em>level</em></span>
|
||||
argument to <span class="emphasis"><em>POSIX</em></span> <a href="http://www.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html" target="_top"><code class="computeroutput"><span class="identifier">setsockopt</span><span class="special">()</span></code></a>
|
||||
(or equivalent).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">a.name(p)</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">int</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a value suitable for passing as the <span class="emphasis"><em>option_name</em></span>
|
||||
argument to <span class="emphasis"><em>POSIX</em></span> <a href="http://www.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html" target="_top"><code class="computeroutput"><span class="identifier">setsockopt</span><span class="special">()</span></code></a>
|
||||
(or equivalent).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">a.data(p)</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">const void*</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a pointer suitable for passing as the <span class="emphasis"><em>option_value</em></span>
|
||||
argument to <span class="emphasis"><em>POSIX</em></span> <a href="http://www.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html" target="_top"><code class="computeroutput"><span class="identifier">setsockopt</span><span class="special">()</span></code></a>
|
||||
(or equivalent).
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">a.size(p)</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">size_t</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a value suitable for passing as the <span class="emphasis"><em>option_len</em></span>
|
||||
argument to <span class="emphasis"><em>POSIX</em></span> <a href="http://www.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html" target="_top"><code class="computeroutput"><span class="identifier">setsockopt</span><span class="special">()</span></code></a>
|
||||
(or equivalent), after appropriate integer conversion has been
|
||||
performed.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="SettableSerialPortOption.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="ShutdownHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,106 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>SSL shutdown handler requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="SettableSocketOption.html" title="Settable socket option requirements">
|
||||
<link rel="next" href="SignalHandler.html" title="Signal handler requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="SettableSocketOption.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="SignalHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.ShutdownHandler"></a><a class="link" href="ShutdownHandler.html" title="SSL shutdown handler requirements">SSL shutdown handler
|
||||
requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A shutdown handler must meet the requirements for a <a class="link" href="Handler.html" title="Handlers">handler</a>.
|
||||
A value <code class="computeroutput">h</code> of a shutdown handler class should work correctly
|
||||
in the expression <code class="computeroutput">h(ec)</code>, where <code class="computeroutput">ec</code> is an lvalue
|
||||
of type <code class="computeroutput">const error_code</code>.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="asio.reference.ShutdownHandler.h0"></a>
|
||||
<span><a name="asio.reference.ShutdownHandler.examples"></a></span><a class="link" href="ShutdownHandler.html#asio.reference.ShutdownHandler.examples">Examples</a>
|
||||
</h5>
|
||||
<p>
|
||||
A free function as a shutdown handler:
|
||||
</p>
|
||||
<pre class="programlisting">void shutdown_handler(
|
||||
const asio::error_code& ec)
|
||||
{
|
||||
...
|
||||
}
|
||||
</pre>
|
||||
<p>
|
||||
A shutdown handler function object:
|
||||
</p>
|
||||
<pre class="programlisting">struct shutdown_handler
|
||||
{
|
||||
...
|
||||
void operator()(
|
||||
const asio::error_code& ec)
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
};
|
||||
</pre>
|
||||
<p>
|
||||
A lambda as a shutdown handler:
|
||||
</p>
|
||||
<pre class="programlisting">ssl_stream.async_shutdown(...,
|
||||
[](const asio::error_code& ec)
|
||||
{
|
||||
...
|
||||
});
|
||||
</pre>
|
||||
<p>
|
||||
A non-static class member function adapted to a shutdown handler using <code class="computeroutput">std::bind()</code>:
|
||||
</p>
|
||||
<pre class="programlisting">void my_class::shutdown_handler(
|
||||
const asio::error_code& ec)
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
ssl_stream.async_shutdown(
|
||||
std::bind(&my_class::shutdown_handler,
|
||||
this, std::placeholders::_1));
|
||||
</pre>
|
||||
<p>
|
||||
A non-static class member function adapted to a shutdown handler using <code class="computeroutput">boost::bind()</code>:
|
||||
</p>
|
||||
<pre class="programlisting">void my_class::shutdown_handler(
|
||||
const asio::error_code& ec)
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
ssl_stream.async_shutdown(
|
||||
boost::bind(&my_class::shutdown_handler,
|
||||
this, asio::placeholders::error));
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="SettableSocketOption.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="SignalHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,113 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Signal handler requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="ShutdownHandler.html" title="SSL shutdown handler requirements">
|
||||
<link rel="next" href="SyncRandomAccessReadDevice.html" title="Buffer-oriented synchronous random-access read device requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="ShutdownHandler.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="SyncRandomAccessReadDevice.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.SignalHandler"></a><a class="link" href="SignalHandler.html" title="Signal handler requirements">Signal handler requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A signal handler must meet the requirements for a <a class="link" href="Handler.html" title="Handlers">handler</a>.
|
||||
A value <code class="computeroutput">h</code> of a signal handler class should work correctly in
|
||||
the expression <code class="computeroutput">h(ec, n)</code>, where <code class="computeroutput">ec</code> is an lvalue
|
||||
of type <code class="computeroutput">const error_code</code> and <code class="computeroutput">n</code> is an lvalue of
|
||||
type <code class="computeroutput">const int</code>.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="asio.reference.SignalHandler.h0"></a>
|
||||
<span><a name="asio.reference.SignalHandler.examples"></a></span><a class="link" href="SignalHandler.html#asio.reference.SignalHandler.examples">Examples</a>
|
||||
</h5>
|
||||
<p>
|
||||
A free function as a signal handler:
|
||||
</p>
|
||||
<pre class="programlisting">void signal_handler(
|
||||
const asio::error_code& ec,
|
||||
int signal_number)
|
||||
{
|
||||
...
|
||||
}
|
||||
</pre>
|
||||
<p>
|
||||
A signal handler function object:
|
||||
</p>
|
||||
<pre class="programlisting">struct signal_handler
|
||||
{
|
||||
...
|
||||
void operator()(
|
||||
const asio::error_code& ec,
|
||||
int signal_number)
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
};
|
||||
</pre>
|
||||
<p>
|
||||
A lambda as a signal handler:
|
||||
</p>
|
||||
<pre class="programlisting">my_signal_set.async_wait(
|
||||
[](const asio::error_code& ec,
|
||||
int signal_number)
|
||||
{
|
||||
...
|
||||
});
|
||||
</pre>
|
||||
<p>
|
||||
A non-static class member function adapted to a signal handler using <code class="computeroutput">std::bind()</code>:
|
||||
</p>
|
||||
<pre class="programlisting">void my_class::signal_handler(
|
||||
const asio::error_code& ec,
|
||||
int signal_number)
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
my_signal_set.async_wait(
|
||||
std::bind(&my_class::signal_handler,
|
||||
this, std::placeholders::_1,
|
||||
std::placeholders::_2));
|
||||
</pre>
|
||||
<p>
|
||||
A non-static class member function adapted to a signal handler using <code class="computeroutput">boost::bind()</code>:
|
||||
</p>
|
||||
<pre class="programlisting">void my_class::signal_handler(
|
||||
const asio::error_code& ec,
|
||||
int signal_number)
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
my_signal_set.async_wait(
|
||||
boost::bind(&my_class::signal_handler,
|
||||
this, asio::placeholders::error,
|
||||
asio::placeholders::signal_number));
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="ShutdownHandler.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="SyncRandomAccessReadDevice.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,126 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Buffer-oriented synchronous random-access read device requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="SignalHandler.html" title="Signal handler requirements">
|
||||
<link rel="next" href="SyncRandomAccessWriteDevice.html" title="Buffer-oriented synchronous random-access write device requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="SignalHandler.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="SyncRandomAccessWriteDevice.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.SyncRandomAccessReadDevice"></a><a class="link" href="SyncRandomAccessReadDevice.html" title="Buffer-oriented synchronous random-access read device requirements">Buffer-oriented
|
||||
synchronous random-access read device requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput">a</code> denotes a synchronous random-access read
|
||||
device object, <code class="computeroutput">o</code> denotes an offset of type <code class="computeroutput">boost::uint64_t</code>,
|
||||
<code class="computeroutput">mb</code> denotes an object satisfying <a class="link" href="MutableBufferSequence.html" title="Mutable buffer sequence requirements">mutable
|
||||
buffer sequence</a> requirements, and <code class="computeroutput">ec</code> denotes an object
|
||||
of type <code class="computeroutput">error_code</code>.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.SyncRandomAccessReadDevice.t0"></a><p class="title"><b>Table 28. Buffer-oriented synchronous random-access read device requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Buffer-oriented synchronous random-access read device requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
operation
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
semantics, pre/post-conditions
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">a.read_some_at(o, mb);</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">size_t</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Equivalent to:
|
||||
</p>
|
||||
<pre class="programlisting">error_code ec;
|
||||
size_t s = a.read_some_at(o, mb, ec);
|
||||
if (ec) throw system_error(ec);
|
||||
return s;
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">a.read_some_at(o, mb, ec);</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">size_t</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Reads one or more bytes of data from the device <code class="computeroutput">a</code>
|
||||
at offset <code class="computeroutput">o</code>.<br> <br> The mutable buffer sequence
|
||||
<code class="computeroutput">mb</code> specifies memory where the data should be placed.
|
||||
The <code class="computeroutput">read_some_at</code> operation shall always fill a buffer
|
||||
in the sequence completely before proceeding to the next.<br>
|
||||
<br> If successful, returns the number of bytes read and sets
|
||||
<code class="computeroutput">ec</code> such that <code class="computeroutput">!ec</code> is true. If an error
|
||||
occurred, returns <code class="computeroutput">0</code> and sets <code class="computeroutput">ec</code> such
|
||||
that <code class="computeroutput">!!ec</code> is true.<br> <br> If the total size
|
||||
of all buffers in the sequence <code class="computeroutput">mb</code> is <code class="computeroutput">0</code>,
|
||||
the function shall return <code class="computeroutput">0</code> immediately.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="SignalHandler.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="SyncRandomAccessWriteDevice.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,126 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Buffer-oriented synchronous random-access write device requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="SyncRandomAccessReadDevice.html" title="Buffer-oriented synchronous random-access read device requirements">
|
||||
<link rel="next" href="SyncReadStream.html" title="Buffer-oriented synchronous read stream requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="SyncRandomAccessReadDevice.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="SyncReadStream.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.SyncRandomAccessWriteDevice"></a><a class="link" href="SyncRandomAccessWriteDevice.html" title="Buffer-oriented synchronous random-access write device requirements">Buffer-oriented
|
||||
synchronous random-access write device requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput">a</code> denotes a synchronous random-access write
|
||||
device object, <code class="computeroutput">o</code> denotes an offset of type <code class="computeroutput">boost::uint64_t</code>,
|
||||
<code class="computeroutput">cb</code> denotes an object satisfying <a class="link" href="ConstBufferSequence.html" title="Constant buffer sequence requirements">constant
|
||||
buffer sequence</a> requirements, and <code class="computeroutput">ec</code> denotes an object
|
||||
of type <code class="computeroutput">error_code</code>.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.SyncRandomAccessWriteDevice.t0"></a><p class="title"><b>Table 29. Buffer-oriented synchronous random-access write device requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="Buffer-oriented synchronous random-access write device requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
operation
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
semantics, pre/post-conditions
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">a.write_some_at(o, cb);</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">size_t</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Equivalent to:
|
||||
</p>
|
||||
<pre class="programlisting">error_code ec;
|
||||
size_t s = a.write_some(o, cb, ec);
|
||||
if (ec) throw system_error(ec);
|
||||
return s;
|
||||
</pre>
|
||||
<p>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">a.write_some_at(o, cb, ec);</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">size_t</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Writes one or more bytes of data to the device <code class="computeroutput">a</code> at
|
||||
offset <code class="computeroutput">o</code>.<br> <br> The constant buffer sequence
|
||||
<code class="computeroutput">cb</code> specifies memory where the data to be written is
|
||||
located. The <code class="computeroutput">write_some_at</code> operation shall always
|
||||
write a buffer in the sequence completely before proceeding to
|
||||
the next.<br> <br> If successful, returns the number of bytes
|
||||
written and sets <code class="computeroutput">ec</code> such that <code class="computeroutput">!ec</code> is
|
||||
true. If an error occurred, returns <code class="computeroutput">0</code> and sets <code class="computeroutput">ec</code>
|
||||
such that <code class="computeroutput">!!ec</code> is true.<br> <br> If the total
|
||||
size of all buffers in the sequence <code class="computeroutput">cb</code> is <code class="computeroutput">0</code>,
|
||||
the function shall return <code class="computeroutput">0</code> immediately.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="SyncRandomAccessReadDevice.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="SyncReadStream.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,103 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Buffer-oriented synchronous read stream requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="SyncRandomAccessWriteDevice.html" title="Buffer-oriented synchronous random-access write device requirements">
|
||||
<link rel="next" href="SyncWriteStream.html" title="Buffer-oriented synchronous write stream requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="SyncRandomAccessWriteDevice.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="SyncWriteStream.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.SyncReadStream"></a><a class="link" href="SyncReadStream.html" title="Buffer-oriented synchronous read stream requirements">Buffer-oriented synchronous
|
||||
read stream requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A type <code class="computeroutput">X</code> meets the <code class="computeroutput">SyncReadStream</code> requirements
|
||||
if it satisfies the requirements listed below.
|
||||
</p>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput">a</code> denotes a value of type <code class="computeroutput">X</code>,
|
||||
<code class="computeroutput">mb</code> denotes a (possibly const) value satisfying the <a class="link" href="MutableBufferSequence.html" title="Mutable buffer sequence requirements"><code class="computeroutput">MutableBufferSequence</code></a>
|
||||
requirements, and <code class="computeroutput">ec</code> denotes an object of type <code class="computeroutput">error_code</code>.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.SyncReadStream.t0"></a><p class="title"><b>Table 30. SyncReadStream requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="SyncReadStream requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
operation
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
semantics, pre/post-conditions
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody><tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">a.read_some(mb)</code><br> <code class="computeroutput">a.read_some(mb,ec)</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">size_t</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Meets the requirements for a <a class="link" href="read_write_operations.html" title="Requirements on read and write operations">read
|
||||
operation</a>.<br> <br> If <code class="computeroutput">buffer_size(mb) > 0</code>,
|
||||
reads one or more bytes of data from the stream <code class="computeroutput">a</code>
|
||||
into the buffer sequence <code class="computeroutput">mb</code>. If successful, sets
|
||||
<code class="computeroutput">ec</code> such that <code class="computeroutput">!ec</code> is <code class="computeroutput">true</code>,
|
||||
and returns the number of bytes read. If an error occurred, sets
|
||||
<code class="computeroutput">ec</code> such that <code class="computeroutput">!!ec</code> is <code class="computeroutput">true</code>,
|
||||
and returns 0. If all data has been read from the stream, and the
|
||||
stream performed an orderly shutdown, sets <code class="computeroutput">ec</code> to
|
||||
<code class="computeroutput">stream_errc::eof</code> and returns 0.<br> <br> If <code class="computeroutput">buffer_size(mb)
|
||||
== 0</code>, the operation shall not block. Sets <code class="computeroutput">ec</code>
|
||||
such that <code class="computeroutput">!ec</code> is <code class="computeroutput">true</code>, and returns 0.
|
||||
</p>
|
||||
</td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="SyncRandomAccessWriteDevice.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="SyncWriteStream.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,101 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Buffer-oriented synchronous write stream requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="SyncReadStream.html" title="Buffer-oriented synchronous read stream requirements">
|
||||
<link rel="next" href="TimeTraits.html" title="Time traits requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<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>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.SyncWriteStream"></a><a class="link" href="SyncWriteStream.html" title="Buffer-oriented synchronous write stream requirements">Buffer-oriented synchronous
|
||||
write stream requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A type <code class="computeroutput">X</code> meets the <code class="computeroutput">SyncWriteStream</code> requirements
|
||||
if it satisfies the requirements listed below.
|
||||
</p>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput">a</code> denotes a value of type <code class="computeroutput">X</code>,
|
||||
<code class="computeroutput">cb</code> denotes a (possibly const) value satisfying the <a class="link" href="ConstBufferSequence.html" title="Constant buffer sequence requirements"><code class="computeroutput">ConstBufferSequence</code></a>
|
||||
requirements, and <code class="computeroutput">ec</code> denotes an object of type <code class="computeroutput">error_code</code>.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.SyncWriteStream.t0"></a><p class="title"><b>Table 31. SyncWriteStream requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="SyncWriteStream requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
operation
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
semantics, pre/post-conditions
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody><tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">a.write_some(cb)</code><br> <code class="computeroutput">a.write_some(cb,ec)</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">size_t</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Meets the requirements for a <a class="link" href="read_write_operations.html" title="Requirements on read and write operations">write
|
||||
operation</a>.<br> <br> If <code class="computeroutput">buffer_size(cb) > 0</code>,
|
||||
writes one or more bytes of data to the stream <code class="computeroutput">a</code> from
|
||||
the buffer sequence <code class="computeroutput">cb</code>. If successful, sets <code class="computeroutput">ec</code>
|
||||
such that <code class="computeroutput">!ec</code> is <code class="computeroutput">true</code>, and returns the
|
||||
number of bytes written. If an error occurred, sets <code class="computeroutput">ec</code>
|
||||
such that <code class="computeroutput">!!ec</code> is <code class="computeroutput">true</code>, and returns 0.<br>
|
||||
<br> If <code class="computeroutput">buffer_size(cb) == 0</code>, the operation shall
|
||||
not block. Sets <code class="computeroutput">ec</code> such that <code class="computeroutput">!ec</code> is
|
||||
<code class="computeroutput">true</code>, and returns 0.
|
||||
</p>
|
||||
</td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<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>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,198 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Time traits requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="SyncWriteStream.html" title="Buffer-oriented synchronous write stream requirements">
|
||||
<link rel="next" href="WaitHandler.html" title="Wait handler requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="SyncWriteStream.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="WaitHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.TimeTraits"></a><a class="link" href="TimeTraits.html" title="Time traits requirements">Time traits requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput">X</code> denotes a time traits class for time type
|
||||
<code class="computeroutput">Time</code>, <code class="computeroutput">t</code>, <code class="computeroutput">t1</code>, and <code class="computeroutput">t2</code> denote
|
||||
values of type <code class="computeroutput">Time</code>, and <code class="computeroutput">d</code> denotes a value of type
|
||||
<code class="computeroutput">X::duration_type</code>.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.TimeTraits.t0"></a><p class="title"><b>Table 32. TimeTraits requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="TimeTraits requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
return type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-condition
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">X::time_type</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">Time</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Represents an absolute time. Must support default construction,
|
||||
and meet the requirements for <code class="computeroutput">CopyConstructible</code> and
|
||||
<code class="computeroutput">Assignable</code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">X::duration_type</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Represents the difference between two absolute times. Must support
|
||||
default construction, and meet the requirements for <code class="computeroutput">CopyConstructible</code>
|
||||
and <code class="computeroutput">Assignable</code>. A duration can be positive, negative,
|
||||
or zero.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">X::now();</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">time_type</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns the current time.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">X::add(t, d);</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">time_type</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a new absolute time resulting from adding the duration
|
||||
<code class="computeroutput">d</code> to the absolute time <code class="computeroutput">t</code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">X::subtract(t1, t2);</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">duration_type</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns the duration resulting from subtracting <code class="computeroutput">t2</code>
|
||||
from <code class="computeroutput">t1</code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">X::less_than(t1, t2);</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">bool</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns whether <code class="computeroutput">t1</code> is to be treated as less than
|
||||
<code class="computeroutput">t2</code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">X::to_posix_duration(d);</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">date_time::time_duration_type</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns the <code class="computeroutput">date_time::time_duration_type</code> value that
|
||||
most closely represents the duration <code class="computeroutput">d</code>.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="SyncWriteStream.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="WaitHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,105 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Wait handler requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="TimeTraits.html" title="Time traits requirements">
|
||||
<link rel="next" href="WaitTraits.html" title="Wait traits requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="TimeTraits.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="WaitTraits.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.WaitHandler"></a><a class="link" href="WaitHandler.html" title="Wait handler requirements">Wait handler requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A wait handler must meet the requirements for a <a class="link" href="Handler.html" title="Handlers">handler</a>.
|
||||
A value <code class="computeroutput">h</code> of a wait handler class should work correctly in the
|
||||
expression <code class="computeroutput">h(ec)</code>, where <code class="computeroutput">ec</code> is an lvalue of type
|
||||
<code class="computeroutput">const error_code</code>.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="asio.reference.WaitHandler.h0"></a>
|
||||
<span><a name="asio.reference.WaitHandler.examples"></a></span><a class="link" href="WaitHandler.html#asio.reference.WaitHandler.examples">Examples</a>
|
||||
</h5>
|
||||
<p>
|
||||
A free function as a wait handler:
|
||||
</p>
|
||||
<pre class="programlisting">void wait_handler(
|
||||
const asio::error_code& ec)
|
||||
{
|
||||
...
|
||||
}
|
||||
</pre>
|
||||
<p>
|
||||
A wait handler function object:
|
||||
</p>
|
||||
<pre class="programlisting">struct wait_handler
|
||||
{
|
||||
...
|
||||
void operator()(
|
||||
const asio::error_code& ec)
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
};
|
||||
</pre>
|
||||
<p>
|
||||
A lambda as a wait handler:
|
||||
</p>
|
||||
<pre class="programlisting">socket.async_wait(...,
|
||||
[](const asio::error_code& ec)
|
||||
{
|
||||
...
|
||||
});
|
||||
</pre>
|
||||
<p>
|
||||
A non-static class member function adapted to a wait handler using <code class="computeroutput">std::bind()</code>:
|
||||
</p>
|
||||
<pre class="programlisting">void my_class::wait_handler(
|
||||
const asio::error_code& ec)
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
socket.async_wait(...,
|
||||
std::bind(&my_class::wait_handler,
|
||||
this, std::placeholders::_1));
|
||||
</pre>
|
||||
<p>
|
||||
A non-static class member function adapted to a wait handler using <code class="computeroutput">boost::bind()</code>:
|
||||
</p>
|
||||
<pre class="programlisting">void my_class::wait_handler(
|
||||
const asio::error_code& ec)
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
socket.async_wait(...,
|
||||
boost::bind(&my_class::wait_handler,
|
||||
this, asio::placeholders::error));
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="TimeTraits.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="WaitTraits.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,130 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Wait traits requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="WaitHandler.html" title="Wait handler requirements">
|
||||
<link rel="next" href="WriteHandler.html" title="Write handler requirements">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="WaitHandler.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="WriteHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.WaitTraits"></a><a class="link" href="WaitTraits.html" title="Wait traits requirements">Wait traits requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
The <code class="computeroutput">basic_waitable_timer</code> template uses wait traits to allow
|
||||
programs to customize <code class="computeroutput">wait</code> and <code class="computeroutput">async_wait</code> behavior.
|
||||
[<span class="emphasis"><em>Note:</em></span> Possible uses of wait traits include:<br> — To
|
||||
enable timers based on non-realtime clocks.<br> — Determining how quickly
|
||||
wallclock-based timers respond to system time changes.<br> — Correcting for
|
||||
errors or rounding timeouts to boundaries.<br> — Preventing duration overflow.
|
||||
That is, a program may set a timer's expiry <code class="computeroutput">e</code> to be <code class="computeroutput">Clock::max()</code>
|
||||
(meaning never reached) or <code class="computeroutput">Clock::min()</code> (meaning always in the
|
||||
past). As a result, computing the duration until timer expiry as <code class="computeroutput">e
|
||||
- Clock::now()</code> may cause overflow. —<span class="emphasis"><em>end note</em></span>]
|
||||
</p>
|
||||
<p>
|
||||
For a type <code class="computeroutput">Clock</code> meeting the <code class="computeroutput">Clock</code> requirements
|
||||
(C++Std [time.clock.req]), a type <code class="computeroutput">X</code> meets the <code class="computeroutput">WaitTraits</code>
|
||||
requirements if it satisfies the requirements listed below.
|
||||
</p>
|
||||
<p>
|
||||
In the table below, <code class="computeroutput">t</code> denotes a (possibly const) value of type
|
||||
<code class="computeroutput">Clock::time_point</code>; and <code class="computeroutput">d</code> denotes a (possibly const)
|
||||
value of type <code class="computeroutput">Clock::duration</code>.
|
||||
</p>
|
||||
<div class="table">
|
||||
<a name="asio.reference.WaitTraits.t0"></a><p class="title"><b>Table 33. WaitTraits requirements</b></p>
|
||||
<div class="table-contents"><table class="table" summary="WaitTraits requirements">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
expression
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
return type
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
assertion/note<br> pre/post-condition
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">X::to_wait_duration(d)</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">Clock::duration</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a <code class="computeroutput">Clock::duration</code> value to be used in a <code class="computeroutput">wait</code>
|
||||
or <code class="computeroutput">async_wait</code> operation. [<span class="emphasis"><em>Note:</em></span>
|
||||
The return value is typically representative of the duration <code class="computeroutput">d</code>.
|
||||
—<span class="emphasis"><em>end note</em></span>]
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">X::to_wait_duration(t)</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<code class="computeroutput">Clock::duration</code>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Returns a <code class="computeroutput">Clock::duration</code> value to be used in a <code class="computeroutput">wait</code>
|
||||
or <code class="computeroutput">async_wait</code> operation. [<span class="emphasis"><em>Note:</em></span>
|
||||
The return value is typically representative of the duration from
|
||||
<code class="computeroutput">Clock::now()</code> until the time point <code class="computeroutput">t</code>.
|
||||
—<span class="emphasis"><em>end note</em></span>]
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<br class="table-break">
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="WaitHandler.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="WriteHandler.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,113 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Write handler requirements</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="WaitTraits.html" title="Wait traits requirements">
|
||||
<link rel="next" href="any_io_executor.html" title="any_io_executor">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="WaitTraits.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="any_io_executor.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.WriteHandler"></a><a class="link" href="WriteHandler.html" title="Write handler requirements">Write handler requirements</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
A write handler must meet the requirements for a <a class="link" href="Handler.html" title="Handlers">handler</a>.
|
||||
A value <code class="computeroutput">h</code> of a write handler class should work correctly in
|
||||
the expression <code class="computeroutput">h(ec, s)</code>, where <code class="computeroutput">ec</code> is an lvalue
|
||||
of type <code class="computeroutput">const error_code</code> and <code class="computeroutput">s</code> is an lvalue of
|
||||
type <code class="computeroutput">const size_t</code>.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="asio.reference.WriteHandler.h0"></a>
|
||||
<span><a name="asio.reference.WriteHandler.examples"></a></span><a class="link" href="WriteHandler.html#asio.reference.WriteHandler.examples">Examples</a>
|
||||
</h5>
|
||||
<p>
|
||||
A free function as a write handler:
|
||||
</p>
|
||||
<pre class="programlisting">void write_handler(
|
||||
const asio::error_code& ec,
|
||||
std::size_t bytes_transferred)
|
||||
{
|
||||
...
|
||||
}
|
||||
</pre>
|
||||
<p>
|
||||
A write handler function object:
|
||||
</p>
|
||||
<pre class="programlisting">struct write_handler
|
||||
{
|
||||
...
|
||||
void operator()(
|
||||
const asio::error_code& ec,
|
||||
std::size_t bytes_transferred)
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
};
|
||||
</pre>
|
||||
<p>
|
||||
A lambda as a write handler:
|
||||
</p>
|
||||
<pre class="programlisting">socket.async_write(...
|
||||
[](const asio::error_code& ec,
|
||||
std::size_t bytes_transferred)
|
||||
{
|
||||
...
|
||||
});
|
||||
</pre>
|
||||
<p>
|
||||
A non-static class member function adapted to a write handler using <code class="computeroutput">std::bind()</code>:
|
||||
</p>
|
||||
<pre class="programlisting">void my_class::write_handler(
|
||||
const asio::error_code& ec,
|
||||
std::size_t bytes_transferred)
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
socket.async_write(...,
|
||||
std::bind(&my_class::write_handler,
|
||||
this, std::placeholders::_1,
|
||||
std::placeholders::_2));
|
||||
</pre>
|
||||
<p>
|
||||
A non-static class member function adapted to a write handler using <code class="computeroutput">boost::bind()</code>:
|
||||
</p>
|
||||
<pre class="programlisting">void my_class::write_handler(
|
||||
const asio::error_code& ec,
|
||||
std::size_t bytes_transferred)
|
||||
{
|
||||
...
|
||||
}
|
||||
...
|
||||
socket.async_write(...,
|
||||
boost::bind(&my_class::write_handler,
|
||||
this, asio::placeholders::error,
|
||||
asio::placeholders::bytes_transferred));
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="WaitTraits.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="any_io_executor.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,294 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>any_io_executor</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="WriteHandler.html" title="Write handler requirements">
|
||||
<link rel="next" href="asio_handler_allocate.html" title="asio_handler_allocate">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="WriteHandler.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="asio_handler_allocate.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.any_io_executor"></a><a class="link" href="any_io_executor.html" title="any_io_executor">any_io_executor</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
<a class="indexterm" name="asio.indexterm.any_io_executor"></a>
|
||||
Polymorphic executor type for
|
||||
use with I/O objects.
|
||||
</p>
|
||||
<pre class="programlisting">typedef execution::any_executor<...> any_io_executor;
|
||||
</pre>
|
||||
<h5>
|
||||
<a name="asio.reference.any_io_executor.h0"></a>
|
||||
<span><a name="asio.reference.any_io_executor.member_functions"></a></span><a class="link" href="any_io_executor.html#asio.reference.any_io_executor.member_functions">Member
|
||||
Functions</a>
|
||||
</h5>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Name
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Description
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<a class="link" href="execution__any_executor/any_executor.html" title="execution::any_executor::any_executor"><span class="bold"><strong>any_executor</strong></span></a> <span class="silver">[constructor]</span>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Default constructor. <br> <span class="silver"> —</span><br> Construct in an empty state.
|
||||
Equivalent effects to default constructor. <br> <span class="silver"> —</span><br> Copy constructor.
|
||||
<br> <span class="silver"> —</span><br> Move constructor. <br> <span class="silver"> —</span><br> Construct to point
|
||||
to the same target as another any_executor. <br> <span class="silver"> —</span><br> Construct
|
||||
a polymorphic wrapper for the specified executor.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<a class="link" href="execution__any_executor/context.html" title="execution::any_executor::context"><span class="bold"><strong>context</strong></span></a>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Obtain the underlying execution context.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<a class="link" href="execution__any_executor/execute.html" title="execution::any_executor::execute"><span class="bold"><strong>execute</strong></span></a>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Execute the function on the target executor.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<a class="link" href="execution__any_executor/operator_bool.html" title="execution::any_executor::operator bool"><span class="bold"><strong>operator bool</strong></span></a>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Determine whether the wrapper has a target executor.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<a class="link" href="execution__any_executor/operator_eq_.html" title="execution::any_executor::operator="><span class="bold"><strong>operator=</strong></span></a>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Assignment operator. <br> <span class="silver"> —</span><br> Move assignment operator. <br>
|
||||
<span class="silver"> —</span><br> Assignment operator that sets the polymorphic wrapper to
|
||||
the empty state. <br> <span class="silver"> —</span><br> Assignment operator to create a
|
||||
polymorphic wrapper for the specified executor.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<a class="link" href="execution__any_executor/prefer.html" title="execution::any_executor::prefer"><span class="bold"><strong>prefer</strong></span></a>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Obtain a polymorphic wrapper with the specified property.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<a class="link" href="execution__any_executor/query.html" title="execution::any_executor::query"><span class="bold"><strong>query</strong></span></a>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Obtain the value associated with the specified property.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<a class="link" href="execution__any_executor/require.html" title="execution::any_executor::require"><span class="bold"><strong>require</strong></span></a>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Obtain a polymorphic wrapper with the specified property.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<a class="link" href="execution__any_executor/swap.html" title="execution::any_executor::swap"><span class="bold"><strong>swap</strong></span></a>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Swap targets with another polymorphic wrapper.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<a class="link" href="execution__any_executor/target.html" title="execution::any_executor::target"><span class="bold"><strong>target</strong></span></a>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Get a pointer to the target executor.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<a class="link" href="execution__any_executor/target_type.html" title="execution::any_executor::target_type"><span class="bold"><strong>target_type</strong></span></a>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Get the type of the target executor.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<a class="link" href="execution__any_executor/_any_executor.html" title="execution::any_executor::~any_executor"><span class="bold"><strong>~any_executor</strong></span></a> <span class="silver">[destructor]</span>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Destructor.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<h5>
|
||||
<a name="asio.reference.any_io_executor.h1"></a>
|
||||
<span><a name="asio.reference.any_io_executor.related_functions"></a></span><a class="link" href="any_io_executor.html#asio.reference.any_io_executor.related_functions">Related
|
||||
Functions</a>
|
||||
</h5>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Name
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Description
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<a class="link" href="execution__any_executor/operator_not__eq_.html" title="execution::any_executor::operator!="><span class="bold"><strong>operator!=</strong></span></a>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Inequality operator.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<a class="link" href="execution__any_executor/operator_eq__eq_.html" title="execution::any_executor::operator=="><span class="bold"><strong>operator==</strong></span></a>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Equality operator.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
The <code class="computeroutput">any_io_executor</code> type is a polymorphic executor that supports
|
||||
the set of properties required by I/O objects. It is defined as the <a class="link" href="execution__any_executor.html" title="execution::any_executor"><code class="computeroutput">execution::any_executor</code></a>
|
||||
class template parameterised as follows:
|
||||
</p>
|
||||
<pre class="programlisting">execution::any_executor<
|
||||
execution::context_as_t<execution_context&>,
|
||||
execution::blocking_t::never_t,
|
||||
execution::prefer_only<execution::blocking_t::possibly_t>,
|
||||
execution::prefer_only<execution::outstanding_work_t::tracked_t>,
|
||||
execution::prefer_only<execution::outstanding_work_t::untracked_t>,
|
||||
execution::prefer_only<execution::relationship_t::fork_t>,
|
||||
execution::prefer_only<execution::relationship_t::continuation_t>
|
||||
>
|
||||
</pre>
|
||||
<h5>
|
||||
<a name="asio.reference.any_io_executor.h2"></a>
|
||||
<span><a name="asio.reference.any_io_executor.requirements"></a></span><a class="link" href="any_io_executor.html#asio.reference.any_io_executor.requirements">Requirements</a>
|
||||
</h5>
|
||||
<p>
|
||||
<span class="emphasis"><em>Header: </em></span><code class="literal">asio/any_io_executor.hpp</code>
|
||||
</p>
|
||||
<p>
|
||||
<span class="emphasis"><em>Convenience header: </em></span><code class="literal">asio.hpp</code>
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="WriteHandler.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="asio_handler_allocate.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,96 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>asio_handler_allocate</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="any_io_executor.html" title="any_io_executor">
|
||||
<link rel="next" href="asio_handler_deallocate.html" title="asio_handler_deallocate">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="any_io_executor.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="asio_handler_deallocate.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.asio_handler_allocate"></a><a class="link" href="asio_handler_allocate.html" title="asio_handler_allocate">asio_handler_allocate</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
<a class="indexterm" name="asio.indexterm.asio_handler_allocate"></a>
|
||||
(Deprecated: Use
|
||||
the <a class="link" href="associated_allocator.html" title="associated_allocator"><code class="computeroutput">associated_allocator</code></a>
|
||||
trait.) Default allocation function for handlers.
|
||||
</p>
|
||||
<pre class="programlisting">asio_handler_allocate_is_deprecated asio_handler_allocate(
|
||||
std::size_t size,
|
||||
... );
|
||||
</pre>
|
||||
<p>
|
||||
Asynchronous operations may need to allocate temporary objects. Since asynchronous
|
||||
operations have a handler function object, these temporary objects can be
|
||||
said to be associated with the handler.
|
||||
</p>
|
||||
<p>
|
||||
Implement asio_handler_allocate and asio_handler_deallocate for your own
|
||||
handlers to provide custom allocation for these temporary objects.
|
||||
</p>
|
||||
<p>
|
||||
The default implementation of these allocation hooks uses <code class="computeroutput">operator
|
||||
new</code> and <code class="computeroutput">operator delete</code>.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="asio.reference.asio_handler_allocate.h0"></a>
|
||||
<span><a name="asio.reference.asio_handler_allocate.remarks"></a></span><a class="link" href="asio_handler_allocate.html#asio.reference.asio_handler_allocate.remarks">Remarks</a>
|
||||
</h5>
|
||||
<p>
|
||||
All temporary objects associated with a handler will be deallocated before
|
||||
the upcall to the handler is performed. This allows the same memory to be
|
||||
reused for a subsequent asynchronous operation initiated by the handler.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="asio.reference.asio_handler_allocate.h1"></a>
|
||||
<span><a name="asio.reference.asio_handler_allocate.example"></a></span><a class="link" href="asio_handler_allocate.html#asio.reference.asio_handler_allocate.example">Example</a>
|
||||
</h5>
|
||||
<pre class="programlisting">class my_handler;
|
||||
|
||||
void* asio_handler_allocate(std::size_t size, my_handler* context)
|
||||
{
|
||||
return ::operator new(size);
|
||||
}
|
||||
|
||||
void asio_handler_deallocate(void* pointer, std::size_t size,
|
||||
my_handler* context)
|
||||
{
|
||||
::operator delete(pointer);
|
||||
}
|
||||
</pre>
|
||||
<h5>
|
||||
<a name="asio.reference.asio_handler_allocate.h2"></a>
|
||||
<span><a name="asio.reference.asio_handler_allocate.requirements"></a></span><a class="link" href="asio_handler_allocate.html#asio.reference.asio_handler_allocate.requirements">Requirements</a>
|
||||
</h5>
|
||||
<p>
|
||||
<span class="emphasis"><em>Header: </em></span><code class="literal">asio/handler_alloc_hook.hpp</code>
|
||||
</p>
|
||||
<p>
|
||||
<span class="emphasis"><em>Convenience header: </em></span><code class="literal">asio.hpp</code>
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="any_io_executor.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="asio_handler_deallocate.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,65 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>asio_handler_deallocate</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="asio_handler_allocate.html" title="asio_handler_allocate">
|
||||
<link rel="next" href="asio_handler_invoke.html" title="asio_handler_invoke">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="asio_handler_allocate.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="asio_handler_invoke.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.asio_handler_deallocate"></a><a class="link" href="asio_handler_deallocate.html" title="asio_handler_deallocate">asio_handler_deallocate</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
<a class="indexterm" name="asio.indexterm.asio_handler_deallocate"></a>
|
||||
Default deallocation
|
||||
function for handlers.
|
||||
</p>
|
||||
<pre class="programlisting">asio_handler_deallocate_is_deprecated asio_handler_deallocate(
|
||||
void * pointer,
|
||||
std::size_t size,
|
||||
... );
|
||||
</pre>
|
||||
<p>
|
||||
Implement asio_handler_allocate and asio_handler_deallocate for your own
|
||||
handlers to provide custom allocation for the associated temporary objects.
|
||||
</p>
|
||||
<p>
|
||||
The default implementation of these allocation hooks uses <code class="computeroutput">operator
|
||||
new</code> and <code class="computeroutput">operator delete</code>.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="asio.reference.asio_handler_deallocate.h0"></a>
|
||||
<span><a name="asio.reference.asio_handler_deallocate.requirements"></a></span><a class="link" href="asio_handler_deallocate.html#asio.reference.asio_handler_deallocate.requirements">Requirements</a>
|
||||
</h5>
|
||||
<p>
|
||||
<span class="emphasis"><em>Header: </em></span><code class="literal">asio/handler_alloc_hook.hpp</code>
|
||||
</p>
|
||||
<p>
|
||||
<span class="emphasis"><em>Convenience header: </em></span><code class="literal">asio.hpp</code>
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="asio_handler_allocate.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="asio_handler_invoke.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,116 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>asio_handler_invoke</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="asio_handler_deallocate.html" title="asio_handler_deallocate">
|
||||
<link rel="next" href="asio_handler_invoke/overload1.html" title="asio_handler_invoke (1 of 2 overloads)">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="asio_handler_deallocate.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="asio_handler_invoke/overload1.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.asio_handler_invoke"></a><a class="link" href="asio_handler_invoke.html" title="asio_handler_invoke">asio_handler_invoke</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
<a class="indexterm" name="asio.indexterm.asio_handler_invoke"></a>
|
||||
(Deprecated: Use the
|
||||
<a class="link" href="associated_executor.html" title="associated_executor"><code class="computeroutput">associated_executor</code></a>
|
||||
trait.) Default invoke function for handlers.
|
||||
</p>
|
||||
<p>
|
||||
Default handler invocation hook used for non-const function objects.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename Function>
|
||||
asio_handler_invoke_is_deprecated <a class="link" href="asio_handler_invoke/overload1.html" title="asio_handler_invoke (1 of 2 overloads)">asio_handler_invoke</a>(
|
||||
Function & function,
|
||||
... );
|
||||
<span class="emphasis"><em>» <a class="link" href="asio_handler_invoke/overload1.html" title="asio_handler_invoke (1 of 2 overloads)">more...</a></em></span>
|
||||
</pre>
|
||||
<p>
|
||||
Default handler invocation hook used for const function objects.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename Function>
|
||||
asio_handler_invoke_is_deprecated <a class="link" href="asio_handler_invoke/overload2.html" title="asio_handler_invoke (2 of 2 overloads)">asio_handler_invoke</a>(
|
||||
const Function & function,
|
||||
... );
|
||||
<span class="emphasis"><em>» <a class="link" href="asio_handler_invoke/overload2.html" title="asio_handler_invoke (2 of 2 overloads)">more...</a></em></span>
|
||||
</pre>
|
||||
<p>
|
||||
Completion handlers for asynchronous operations are invoked by the <a class="link" href="io_context.html" title="io_context"><code class="computeroutput">io_context</code></a> associated
|
||||
with the corresponding object (e.g. a socket or deadline_timer). Certain
|
||||
guarantees are made on when the handler may be invoked, in particular that
|
||||
a handler can only be invoked from a thread that is currently calling <code class="computeroutput">run()</code>
|
||||
on the corresponding <a class="link" href="io_context.html" title="io_context"><code class="computeroutput">io_context</code></a>
|
||||
object. Handlers may subsequently be invoked through other objects (such
|
||||
as <a class="link" href="io_context__strand.html" title="io_context::strand"><code class="computeroutput">io_context::strand</code></a>
|
||||
objects) that provide additional guarantees.
|
||||
</p>
|
||||
<p>
|
||||
When asynchronous operations are composed from other asynchronous operations,
|
||||
all intermediate handlers should be invoked using the same method as the
|
||||
final handler. This is required to ensure that user-defined objects are not
|
||||
accessed in a way that may violate the guarantees. This hooking function
|
||||
ensures that the invoked method used for the final handler is accessible
|
||||
at each intermediate step.
|
||||
</p>
|
||||
<p>
|
||||
Implement asio_handler_invoke for your own handlers to specify a custom invocation
|
||||
strategy.
|
||||
</p>
|
||||
<p>
|
||||
This default implementation invokes the function object like so:
|
||||
</p>
|
||||
<pre class="programlisting">function();
|
||||
</pre>
|
||||
<p>
|
||||
If necessary, the default implementation makes a copy of the function object
|
||||
so that the non-const operator() can be used.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="asio.reference.asio_handler_invoke.h0"></a>
|
||||
<span><a name="asio.reference.asio_handler_invoke.example"></a></span><a class="link" href="asio_handler_invoke.html#asio.reference.asio_handler_invoke.example">Example</a>
|
||||
</h5>
|
||||
<pre class="programlisting">class my_handler;
|
||||
|
||||
template <typename Function>
|
||||
void asio_handler_invoke(Function function, my_handler* context)
|
||||
{
|
||||
context->strand_.dispatch(function);
|
||||
}
|
||||
</pre>
|
||||
<h5>
|
||||
<a name="asio.reference.asio_handler_invoke.h1"></a>
|
||||
<span><a name="asio.reference.asio_handler_invoke.requirements"></a></span><a class="link" href="asio_handler_invoke.html#asio.reference.asio_handler_invoke.requirements">Requirements</a>
|
||||
</h5>
|
||||
<p>
|
||||
<span class="emphasis"><em>Header: </em></span><code class="literal">asio/handler_invoke_hook.hpp</code>
|
||||
</p>
|
||||
<p>
|
||||
<span class="emphasis"><em>Convenience header: </em></span><code class="literal">asio.hpp</code>
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="asio_handler_deallocate.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="asio_handler_invoke/overload1.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,47 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>asio_handler_invoke (1 of 2 overloads)</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../asio_handler_invoke.html" title="asio_handler_invoke">
|
||||
<link rel="prev" href="../asio_handler_invoke.html" title="asio_handler_invoke">
|
||||
<link rel="next" href="overload2.html" title="asio_handler_invoke (2 of 2 overloads)">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../asio_handler_invoke.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../asio_handler_invoke.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="overload2.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.reference.asio_handler_invoke.overload1"></a><a class="link" href="overload1.html" title="asio_handler_invoke (1 of 2 overloads)">asio_handler_invoke
|
||||
(1 of 2 overloads)</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Default handler invocation hook used for non-const function objects.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename Function>
|
||||
asio_handler_invoke_is_deprecated asio_handler_invoke(
|
||||
Function & function,
|
||||
... );
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../asio_handler_invoke.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../asio_handler_invoke.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="overload2.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,47 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>asio_handler_invoke (2 of 2 overloads)</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../asio_handler_invoke.html" title="asio_handler_invoke">
|
||||
<link rel="prev" href="overload1.html" title="asio_handler_invoke (1 of 2 overloads)">
|
||||
<link rel="next" href="../asio_handler_is_continuation.html" title="asio_handler_is_continuation">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload1.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../asio_handler_invoke.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="../asio_handler_is_continuation.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.reference.asio_handler_invoke.overload2"></a><a class="link" href="overload2.html" title="asio_handler_invoke (2 of 2 overloads)">asio_handler_invoke
|
||||
(2 of 2 overloads)</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Default handler invocation hook used for const function objects.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename Function>
|
||||
asio_handler_invoke_is_deprecated asio_handler_invoke(
|
||||
const Function & function,
|
||||
... );
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload1.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../asio_handler_invoke.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="../asio_handler_is_continuation.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,78 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>asio_handler_is_continuation</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="asio_handler_invoke/overload2.html" title="asio_handler_invoke (2 of 2 overloads)">
|
||||
<link rel="next" href="associated_allocator.html" title="associated_allocator">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="asio_handler_invoke/overload2.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="associated_allocator.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.asio_handler_is_continuation"></a><a class="link" href="asio_handler_is_continuation.html" title="asio_handler_is_continuation">asio_handler_is_continuation</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
<a class="indexterm" name="asio.indexterm.asio_handler_is_continuation"></a>
|
||||
Default
|
||||
continuation function for handlers.
|
||||
</p>
|
||||
<pre class="programlisting">bool asio_handler_is_continuation(
|
||||
... );
|
||||
</pre>
|
||||
<p>
|
||||
Asynchronous operations may represent a continuation of the asynchronous
|
||||
control flow associated with the current handler. The implementation can
|
||||
use this knowledge to optimise scheduling of the handler.
|
||||
</p>
|
||||
<p>
|
||||
Implement asio_handler_is_continuation for your own handlers to indicate
|
||||
when a handler represents a continuation.
|
||||
</p>
|
||||
<p>
|
||||
The default implementation of the continuation hook returns <code class="computeroutput">false</code>.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="asio.reference.asio_handler_is_continuation.h0"></a>
|
||||
<span><a name="asio.reference.asio_handler_is_continuation.example"></a></span><a class="link" href="asio_handler_is_continuation.html#asio.reference.asio_handler_is_continuation.example">Example</a>
|
||||
</h5>
|
||||
<pre class="programlisting">class my_handler;
|
||||
|
||||
bool asio_handler_is_continuation(my_handler* context)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
</pre>
|
||||
<h5>
|
||||
<a name="asio.reference.asio_handler_is_continuation.h1"></a>
|
||||
<span><a name="asio.reference.asio_handler_is_continuation.requirements"></a></span><a class="link" href="asio_handler_is_continuation.html#asio.reference.asio_handler_is_continuation.requirements">Requirements</a>
|
||||
</h5>
|
||||
<p>
|
||||
<span class="emphasis"><em>Header: </em></span><code class="literal">asio/handler_continuation_hook.hpp</code>
|
||||
</p>
|
||||
<p>
|
||||
<span class="emphasis"><em>Convenience header: </em></span><code class="literal">asio.hpp</code>
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="asio_handler_invoke/overload2.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="associated_allocator.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,149 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>associated_allocator</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="asio_handler_is_continuation.html" title="asio_handler_is_continuation">
|
||||
<link rel="next" href="associated_allocator/get.html" title="associated_allocator::get">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="asio_handler_is_continuation.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="associated_allocator/get.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.associated_allocator"></a><a class="link" href="associated_allocator.html" title="associated_allocator">associated_allocator</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
Traits type used to obtain the allocator associated with an object.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename T,
|
||||
typename Allocator = std::allocator<void>>
|
||||
struct associated_allocator
|
||||
</pre>
|
||||
<h5>
|
||||
<a name="asio.reference.associated_allocator.h0"></a>
|
||||
<span><a name="asio.reference.associated_allocator.types"></a></span><a class="link" href="associated_allocator.html#asio.reference.associated_allocator.types">Types</a>
|
||||
</h5>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Name
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Description
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody><tr>
|
||||
<td>
|
||||
<p>
|
||||
<a class="link" href="associated_allocator/type.html" title="associated_allocator::type"><span class="bold"><strong>type</strong></span></a>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
If T has a nested type allocator_type, T::allocator_type. Otherwise
|
||||
Allocator.
|
||||
</p>
|
||||
</td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<h5>
|
||||
<a name="asio.reference.associated_allocator.h1"></a>
|
||||
<span><a name="asio.reference.associated_allocator.member_functions"></a></span><a class="link" href="associated_allocator.html#asio.reference.associated_allocator.member_functions">Member Functions</a>
|
||||
</h5>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Name
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Description
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody><tr>
|
||||
<td>
|
||||
<p>
|
||||
<a class="link" href="associated_allocator/get.html" title="associated_allocator::get"><span class="bold"><strong>get</strong></span></a> <span class="silver">[static]</span>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
If T has a nested type allocator_type, returns t.get_allocator().
|
||||
Otherwise returns a.
|
||||
</p>
|
||||
</td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
A program may specialise this traits type if the <code class="computeroutput">T</code> template
|
||||
parameter in the specialisation is a user-defined type. The template parameter
|
||||
<code class="computeroutput">Allocator</code> shall be a type meeting the Allocator requirements.
|
||||
</p>
|
||||
<p>
|
||||
Specialisations shall meet the following requirements, where <code class="computeroutput">t</code>
|
||||
is a const reference to an object of type <code class="computeroutput">T</code>, and <code class="computeroutput">a</code>
|
||||
is an object of type <code class="computeroutput">Allocator</code>.
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
Provide a nested typedef <code class="computeroutput">type</code> that identifies a type meeting
|
||||
the Allocator requirements.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Provide a noexcept static member function named <code class="computeroutput">get</code>, callable
|
||||
as <code class="computeroutput">get(t)</code> and with return type <code class="computeroutput">type</code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Provide a noexcept static member function named <code class="computeroutput">get</code>, callable
|
||||
as <code class="computeroutput">get(t,a)</code> and with return type <code class="computeroutput">type</code>.
|
||||
</li>
|
||||
</ul></div>
|
||||
<h5>
|
||||
<a name="asio.reference.associated_allocator.h2"></a>
|
||||
<span><a name="asio.reference.associated_allocator.requirements"></a></span><a class="link" href="associated_allocator.html#asio.reference.associated_allocator.requirements">Requirements</a>
|
||||
</h5>
|
||||
<p>
|
||||
<span class="emphasis"><em>Header: </em></span><code class="literal">asio/associated_allocator.hpp</code>
|
||||
</p>
|
||||
<p>
|
||||
<span class="emphasis"><em>Convenience header: </em></span><code class="literal">asio.hpp</code>
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="asio_handler_is_continuation.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="associated_allocator/get.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,47 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>associated_allocator::get</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../associated_allocator.html" title="associated_allocator">
|
||||
<link rel="prev" href="../associated_allocator.html" title="associated_allocator">
|
||||
<link rel="next" href="type.html" title="associated_allocator::type">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../associated_allocator.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../associated_allocator.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="type.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.reference.associated_allocator.get"></a><a class="link" href="get.html" title="associated_allocator::get">associated_allocator::get</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
<a class="indexterm" name="asio.indexterm.associated_allocator.get"></a>
|
||||
If <code class="computeroutput">T</code>
|
||||
has a nested type <code class="computeroutput">allocator_type</code>, returns <code class="computeroutput">t.get_allocator()</code>.
|
||||
Otherwise returns <code class="computeroutput">a</code>.
|
||||
</p>
|
||||
<pre class="programlisting">static type get(
|
||||
const T & t,
|
||||
const Allocator & a = Allocator());
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../associated_allocator.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../associated_allocator.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="type.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,55 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>associated_allocator::type</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../associated_allocator.html" title="associated_allocator">
|
||||
<link rel="prev" href="get.html" title="associated_allocator::get">
|
||||
<link rel="next" href="../associated_executor.html" title="associated_executor">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="get.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../associated_allocator.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="../associated_executor.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.reference.associated_allocator.type"></a><a class="link" href="type.html" title="associated_allocator::type">associated_allocator::type</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
<a class="indexterm" name="asio.indexterm.associated_allocator.type"></a>
|
||||
If <code class="computeroutput">T</code>
|
||||
has a nested type <code class="computeroutput">allocator_type</code>, <code class="computeroutput">T::allocator_type</code>.
|
||||
Otherwise <code class="computeroutput">Allocator</code>.
|
||||
</p>
|
||||
<pre class="programlisting">typedef see_below type;
|
||||
</pre>
|
||||
<h6>
|
||||
<a name="asio.reference.associated_allocator.type.h0"></a>
|
||||
<span><a name="asio.reference.associated_allocator.type.requirements"></a></span><a class="link" href="type.html#asio.reference.associated_allocator.type.requirements">Requirements</a>
|
||||
</h6>
|
||||
<p>
|
||||
<span class="emphasis"><em>Header: </em></span><code class="literal">asio/associated_allocator.hpp</code>
|
||||
</p>
|
||||
<p>
|
||||
<span class="emphasis"><em>Convenience header: </em></span><code class="literal">asio.hpp</code>
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="get.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../associated_allocator.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="../associated_executor.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,150 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>associated_executor</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="associated_allocator/type.html" title="associated_allocator::type">
|
||||
<link rel="next" href="associated_executor/get.html" title="associated_executor::get">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="associated_allocator/type.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="associated_executor/get.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.associated_executor"></a><a class="link" href="associated_executor.html" title="associated_executor">associated_executor</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
Traits type used to obtain the executor associated with an object.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename T,
|
||||
typename <a class="link" href="Executor1.html" title="Executor requirements">Executor</a> = system_executor>
|
||||
struct associated_executor
|
||||
</pre>
|
||||
<h5>
|
||||
<a name="asio.reference.associated_executor.h0"></a>
|
||||
<span><a name="asio.reference.associated_executor.types"></a></span><a class="link" href="associated_executor.html#asio.reference.associated_executor.types">Types</a>
|
||||
</h5>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Name
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Description
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody><tr>
|
||||
<td>
|
||||
<p>
|
||||
<a class="link" href="associated_executor/type.html" title="associated_executor::type"><span class="bold"><strong>type</strong></span></a>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
If T has a nested type executor_type, T::executor_type. Otherwise
|
||||
Executor.
|
||||
</p>
|
||||
</td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<h5>
|
||||
<a name="asio.reference.associated_executor.h1"></a>
|
||||
<span><a name="asio.reference.associated_executor.member_functions"></a></span><a class="link" href="associated_executor.html#asio.reference.associated_executor.member_functions">Member
|
||||
Functions</a>
|
||||
</h5>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Name
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Description
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody><tr>
|
||||
<td>
|
||||
<p>
|
||||
<a class="link" href="associated_executor/get.html" title="associated_executor::get"><span class="bold"><strong>get</strong></span></a> <span class="silver">[static]</span>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
If T has a nested type executor_type, returns t.get_executor().
|
||||
Otherwise returns ex.
|
||||
</p>
|
||||
</td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
A program may specialise this traits type if the <code class="computeroutput">T</code> template
|
||||
parameter in the specialisation is a user-defined type. The template parameter
|
||||
<code class="computeroutput">Executor</code> shall be a type meeting the Executor requirements.
|
||||
</p>
|
||||
<p>
|
||||
Specialisations shall meet the following requirements, where <code class="computeroutput">t</code>
|
||||
is a const reference to an object of type <code class="computeroutput">T</code>, and <code class="computeroutput">e</code>
|
||||
is an object of type <code class="computeroutput">Executor</code>.
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
Provide a nested typedef <code class="computeroutput">type</code> that identifies a type meeting
|
||||
the Executor requirements.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Provide a noexcept static member function named <code class="computeroutput">get</code>, callable
|
||||
as <code class="computeroutput">get(t)</code> and with return type <code class="computeroutput">type</code>.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Provide a noexcept static member function named <code class="computeroutput">get</code>, callable
|
||||
as <code class="computeroutput">get(t,e)</code> and with return type <code class="computeroutput">type</code>.
|
||||
</li>
|
||||
</ul></div>
|
||||
<h5>
|
||||
<a name="asio.reference.associated_executor.h2"></a>
|
||||
<span><a name="asio.reference.associated_executor.requirements"></a></span><a class="link" href="associated_executor.html#asio.reference.associated_executor.requirements">Requirements</a>
|
||||
</h5>
|
||||
<p>
|
||||
<span class="emphasis"><em>Header: </em></span><code class="literal">asio/associated_executor.hpp</code>
|
||||
</p>
|
||||
<p>
|
||||
<span class="emphasis"><em>Convenience header: </em></span><code class="literal">asio.hpp</code>
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="associated_allocator/type.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="associated_executor/get.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,47 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>associated_executor::get</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../associated_executor.html" title="associated_executor">
|
||||
<link rel="prev" href="../associated_executor.html" title="associated_executor">
|
||||
<link rel="next" href="type.html" title="associated_executor::type">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../associated_executor.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../associated_executor.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="type.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.reference.associated_executor.get"></a><a class="link" href="get.html" title="associated_executor::get">associated_executor::get</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
<a class="indexterm" name="asio.indexterm.associated_executor.get"></a>
|
||||
If <code class="computeroutput">T</code>
|
||||
has a nested type <code class="computeroutput">executor_type</code>, returns <code class="computeroutput">t.get_executor()</code>.
|
||||
Otherwise returns <code class="computeroutput">ex</code>.
|
||||
</p>
|
||||
<pre class="programlisting">static type get(
|
||||
const T & t,
|
||||
const Executor & ex = Executor());
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../associated_executor.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../associated_executor.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="type.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,55 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>associated_executor::type</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../associated_executor.html" title="associated_executor">
|
||||
<link rel="prev" href="get.html" title="associated_executor::get">
|
||||
<link rel="next" href="../async_completion.html" title="async_completion">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="get.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../associated_executor.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="../async_completion.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.reference.associated_executor.type"></a><a class="link" href="type.html" title="associated_executor::type">associated_executor::type</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
<a class="indexterm" name="asio.indexterm.associated_executor.type"></a>
|
||||
If <code class="computeroutput">T</code>
|
||||
has a nested type <code class="computeroutput">executor_type</code>, <code class="computeroutput">T::executor_type</code>.
|
||||
Otherwise <code class="computeroutput">Executor</code>.
|
||||
</p>
|
||||
<pre class="programlisting">typedef see_below type;
|
||||
</pre>
|
||||
<h6>
|
||||
<a name="asio.reference.associated_executor.type.h0"></a>
|
||||
<span><a name="asio.reference.associated_executor.type.requirements"></a></span><a class="link" href="type.html#asio.reference.associated_executor.type.requirements">Requirements</a>
|
||||
</h6>
|
||||
<p>
|
||||
<span class="emphasis"><em>Header: </em></span><code class="literal">asio/associated_executor.hpp</code>
|
||||
</p>
|
||||
<p>
|
||||
<span class="emphasis"><em>Convenience header: </em></span><code class="literal">asio.hpp</code>
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="get.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../associated_executor.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="../async_completion.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,175 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>async_completion</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="associated_executor/type.html" title="associated_executor::type">
|
||||
<link rel="next" href="async_completion/async_completion.html" title="async_completion::async_completion">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="associated_executor/type.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="async_completion/async_completion.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.async_completion"></a><a class="link" href="async_completion.html" title="async_completion">async_completion</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
Helper template to deduce the handler type from a CompletionToken, capture
|
||||
a local copy of the handler, and then create an <a class="link" href="async_result.html" title="async_result"><code class="computeroutput">async_result</code></a>
|
||||
for the handler.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename CompletionToken,
|
||||
typename Signature>
|
||||
struct async_completion
|
||||
</pre>
|
||||
<h5>
|
||||
<a name="asio.reference.async_completion.h0"></a>
|
||||
<span><a name="asio.reference.async_completion.types"></a></span><a class="link" href="async_completion.html#asio.reference.async_completion.types">Types</a>
|
||||
</h5>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Name
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Description
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody><tr>
|
||||
<td>
|
||||
<p>
|
||||
<a class="link" href="async_completion/completion_handler_type.html" title="async_completion::completion_handler_type"><span class="bold"><strong>completion_handler_type</strong></span></a>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The real handler type to be used for the asynchronous operation.
|
||||
</p>
|
||||
</td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<h5>
|
||||
<a name="asio.reference.async_completion.h1"></a>
|
||||
<span><a name="asio.reference.async_completion.member_functions"></a></span><a class="link" href="async_completion.html#asio.reference.async_completion.member_functions">Member
|
||||
Functions</a>
|
||||
</h5>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Name
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Description
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody><tr>
|
||||
<td>
|
||||
<p>
|
||||
<a class="link" href="async_completion/async_completion.html" title="async_completion::async_completion"><span class="bold"><strong>async_completion</strong></span></a> <span class="silver">[constructor]</span>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Constructor.
|
||||
</p>
|
||||
</td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
<h5>
|
||||
<a name="asio.reference.async_completion.h2"></a>
|
||||
<span><a name="asio.reference.async_completion.data_members"></a></span><a class="link" href="async_completion.html#asio.reference.async_completion.data_members">Data
|
||||
Members</a>
|
||||
</h5>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Name
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Description
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<a class="link" href="async_completion/completion_handler.html" title="async_completion::completion_handler"><span class="bold"><strong>completion_handler</strong></span></a>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
A copy of, or reference to, a real handler object.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<a class="link" href="async_completion/result.html" title="async_completion::result"><span class="bold"><strong>result</strong></span></a>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The result of the asynchronous operation's initiating function.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<h5>
|
||||
<a name="asio.reference.async_completion.h3"></a>
|
||||
<span><a name="asio.reference.async_completion.requirements"></a></span><a class="link" href="async_completion.html#asio.reference.async_completion.requirements">Requirements</a>
|
||||
</h5>
|
||||
<p>
|
||||
<span class="emphasis"><em>Header: </em></span><code class="literal">asio/async_result.hpp</code>
|
||||
</p>
|
||||
<p>
|
||||
<span class="emphasis"><em>Convenience header: </em></span><code class="literal">asio.hpp</code>
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="associated_executor/type.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="async_completion/async_completion.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,48 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>async_completion::async_completion</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../async_completion.html" title="async_completion">
|
||||
<link rel="prev" href="../async_completion.html" title="async_completion">
|
||||
<link rel="next" href="completion_handler.html" title="async_completion::completion_handler">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../async_completion.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_completion.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="completion_handler.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.reference.async_completion.async_completion"></a><a class="link" href="async_completion.html" title="async_completion::async_completion">async_completion::async_completion</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
<a class="indexterm" name="asio.indexterm.async_completion.async_completion"></a>
|
||||
Constructor.
|
||||
</p>
|
||||
<pre class="programlisting">async_completion(
|
||||
CompletionToken & token);
|
||||
</pre>
|
||||
<p>
|
||||
The constructor creates the concrete completion handler and makes the link
|
||||
between the handler and the asynchronous result.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../async_completion.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_completion.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="completion_handler.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,44 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>async_completion::completion_handler</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../async_completion.html" title="async_completion">
|
||||
<link rel="prev" href="async_completion.html" title="async_completion::async_completion">
|
||||
<link rel="next" href="completion_handler_type.html" title="async_completion::completion_handler_type">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="async_completion.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_completion.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="completion_handler_type.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.reference.async_completion.completion_handler"></a><a class="link" href="completion_handler.html" title="async_completion::completion_handler">async_completion::completion_handler</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
<a class="indexterm" name="asio.indexterm.async_completion.completion_handler"></a>
|
||||
A
|
||||
copy of, or reference to, a real handler object.
|
||||
</p>
|
||||
<pre class="programlisting">conditional< is_same< CompletionToken, completion_handler_type >::value, completion_handler_type &, completion_handler_type >::type completion_handler;
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="async_completion.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_completion.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="completion_handler_type.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,189 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>async_completion::completion_handler_type</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../async_completion.html" title="async_completion">
|
||||
<link rel="prev" href="completion_handler.html" title="async_completion::completion_handler">
|
||||
<link rel="next" href="result.html" title="async_completion::result">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="completion_handler.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_completion.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="result.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.reference.async_completion.completion_handler_type"></a><a class="link" href="completion_handler_type.html" title="async_completion::completion_handler_type">async_completion::completion_handler_type</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
<a class="indexterm" name="asio.indexterm.async_completion.completion_handler_type"></a>
|
||||
The
|
||||
real handler type to be used for the asynchronous operation.
|
||||
</p>
|
||||
<pre class="programlisting">typedef asio::async_result< typename decay< CompletionToken >::type, Signature >::completion_handler_type completion_handler_type;
|
||||
</pre>
|
||||
<h6>
|
||||
<a name="asio.reference.async_completion.completion_handler_type.h0"></a>
|
||||
<span><a name="asio.reference.async_completion.completion_handler_type.types"></a></span><a class="link" href="completion_handler_type.html#asio.reference.async_completion.completion_handler_type.types">Types</a>
|
||||
</h6>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Name
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Description
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<a class="link" href="../async_result/completion_handler_type.html" title="async_result::completion_handler_type"><span class="bold"><strong>completion_handler_type</strong></span></a>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The concrete completion handler type for the specific signature.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<a class="link" href="../async_result/return_type.html" title="async_result::return_type"><span class="bold"><strong>return_type</strong></span></a>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
The return type of the initiating function.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<h6>
|
||||
<a name="asio.reference.async_completion.completion_handler_type.h1"></a>
|
||||
<span><a name="asio.reference.async_completion.completion_handler_type.member_functions"></a></span><a class="link" href="completion_handler_type.html#asio.reference.async_completion.completion_handler_type.member_functions">Member
|
||||
Functions</a>
|
||||
</h6>
|
||||
<div class="informaltable"><table class="table">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead><tr>
|
||||
<th>
|
||||
<p>
|
||||
Name
|
||||
</p>
|
||||
</th>
|
||||
<th>
|
||||
<p>
|
||||
Description
|
||||
</p>
|
||||
</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<a class="link" href="../async_result/async_result.html" title="async_result::async_result"><span class="bold"><strong>async_result</strong></span></a> <span class="silver">[constructor]</span>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Construct an async result from a given handler.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<a class="link" href="../async_result/get.html" title="async_result::get"><span class="bold"><strong>get</strong></span></a>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Obtain the value to be returned from the initiating function.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>
|
||||
<a class="link" href="../async_result/initiate.html" title="async_result::initiate"><span class="bold"><strong>initiate</strong></span></a> <span class="silver">[static]</span>
|
||||
</p>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
Initiate the asynchronous operation that will produce the result,
|
||||
and obtain the value to be returned from the initiating function.
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
<p>
|
||||
The <a class="link" href="../async_result.html" title="async_result"><code class="computeroutput">async_result</code></a>
|
||||
traits class is used for determining:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
the concrete completion handler type to be called at the end of the
|
||||
asynchronous operation;
|
||||
</li>
|
||||
<li class="listitem">
|
||||
the initiating function return type; and
|
||||
</li>
|
||||
<li class="listitem">
|
||||
how the return value of the initiating function is obtained.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
The trait allows the handler and return types to be determined at the point
|
||||
where the specific completion handler signature is known.
|
||||
</p>
|
||||
<p>
|
||||
This template may be specialised for user-defined completion token types.
|
||||
The primary template assumes that the CompletionToken is the completion
|
||||
handler.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.reference.async_completion.completion_handler_type.h2"></a>
|
||||
<span><a name="asio.reference.async_completion.completion_handler_type.requirements"></a></span><a class="link" href="completion_handler_type.html#asio.reference.async_completion.completion_handler_type.requirements">Requirements</a>
|
||||
</h6>
|
||||
<p>
|
||||
<span class="emphasis"><em>Header: </em></span><code class="literal">asio/async_result.hpp</code>
|
||||
</p>
|
||||
<p>
|
||||
<span class="emphasis"><em>Convenience header: </em></span><code class="literal">asio.hpp</code>
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="completion_handler.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_completion.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="result.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,44 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>async_completion::result</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../async_completion.html" title="async_completion">
|
||||
<link rel="prev" href="completion_handler_type.html" title="async_completion::completion_handler_type">
|
||||
<link rel="next" href="../async_compose.html" title="async_compose">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="completion_handler_type.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_completion.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="../async_compose.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.reference.async_completion.result"></a><a class="link" href="result.html" title="async_completion::result">async_completion::result</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
<a class="indexterm" name="asio.indexterm.async_completion.result"></a>
|
||||
The result
|
||||
of the asynchronous operation's initiating function.
|
||||
</p>
|
||||
<pre class="programlisting">async_result< typename decay< CompletionToken >::type, Signature > result;
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="completion_handler_type.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_completion.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="../async_compose.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,150 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>async_compose</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="async_completion/result.html" title="async_completion::result">
|
||||
<link rel="next" href="async_connect.html" title="async_connect">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="async_completion/result.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="async_connect.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.async_compose"></a><a class="link" href="async_compose.html" title="async_compose">async_compose</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
<a class="indexterm" name="asio.indexterm.async_compose"></a>
|
||||
Launch an asynchronous operation
|
||||
with a stateful implementation.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename CompletionToken,
|
||||
typename Signature,
|
||||
typename Implementation,
|
||||
typename... IoObjectsOrExecutors>
|
||||
<a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> async_compose(
|
||||
Implementation && implementation,
|
||||
CompletionToken & token,
|
||||
IoObjectsOrExecutors &&... io_objects_or_executors);
|
||||
</pre>
|
||||
<p>
|
||||
The async_compose function simplifies the implementation of composed asynchronous
|
||||
operations automatically wrapping a stateful function object with a conforming
|
||||
intermediate completion handler.
|
||||
</p>
|
||||
<h5>
|
||||
<a name="asio.reference.async_compose.h0"></a>
|
||||
<span><a name="asio.reference.async_compose.parameters"></a></span><a class="link" href="async_compose.html#asio.reference.async_compose.parameters">Parameters</a>
|
||||
</h5>
|
||||
<div class="variablelist">
|
||||
<p class="title"><b></b></p>
|
||||
<dl>
|
||||
<dt><span class="term">implementation</span></dt>
|
||||
<dd><p>
|
||||
A function object that contains the implementation of the composed
|
||||
asynchronous operation. The first argument to the function object is
|
||||
a non-const reference to the enclosing intermediate completion handler.
|
||||
The remaining arguments are any arguments that originate from the completion
|
||||
handlers of any asynchronous operations performed by the implementation.
|
||||
</p></dd>
|
||||
<dt><span class="term">token</span></dt>
|
||||
<dd><p>
|
||||
The completion token.
|
||||
</p></dd>
|
||||
<dt><span class="term">io_objects_or_executors</span></dt>
|
||||
<dd><p>
|
||||
Zero or more I/O objects or I/O executors for which outstanding work
|
||||
must be maintained.
|
||||
</p></dd>
|
||||
</dl>
|
||||
</div>
|
||||
<h5>
|
||||
<a name="asio.reference.async_compose.h1"></a>
|
||||
<span><a name="asio.reference.async_compose.example_"></a></span><a class="link" href="async_compose.html#asio.reference.async_compose.example_">Example:</a>
|
||||
</h5>
|
||||
<pre class="programlisting">struct async_echo_implementation
|
||||
{
|
||||
tcp::socket& socket_;
|
||||
asio::mutable_buffer buffer_;
|
||||
enum { starting, reading, writing } state_;
|
||||
|
||||
template <typename Self>
|
||||
void operator()(Self& self,
|
||||
asio::error_code error = {},
|
||||
std::size_t n = 0)
|
||||
{
|
||||
switch (state_)
|
||||
{
|
||||
case starting:
|
||||
state_ = reading;
|
||||
socket_.async_read_some(
|
||||
buffer_, std::move(self));
|
||||
break;
|
||||
case reading:
|
||||
if (error)
|
||||
{
|
||||
self.complete(error, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
state_ = writing;
|
||||
asio::async_write(socket_, buffer_,
|
||||
asio::transfer_exactly(n),
|
||||
std::move(self));
|
||||
}
|
||||
break;
|
||||
case writing:
|
||||
self.complete(error, n);
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <typename CompletionToken>
|
||||
auto async_echo(tcp::socket& socket,
|
||||
asio::mutable_buffer buffer,
|
||||
CompletionToken&& token) ->
|
||||
typename asio::async_result<
|
||||
typename std::decay<CompletionToken>::type,
|
||||
void(asio::error_code, std::size_t)>::return_type
|
||||
{
|
||||
return asio::async_compose<CompletionToken,
|
||||
void(asio::error_code, std::size_t)>(
|
||||
async_echo_implementation{socket, buffer,
|
||||
async_echo_implementation::starting},
|
||||
token, socket);
|
||||
}
|
||||
</pre>
|
||||
<h5>
|
||||
<a name="asio.reference.async_compose.h2"></a>
|
||||
<span><a name="asio.reference.async_compose.requirements"></a></span><a class="link" href="async_compose.html#asio.reference.async_compose.requirements">Requirements</a>
|
||||
</h5>
|
||||
<p>
|
||||
<span class="emphasis"><em>Header: </em></span><code class="literal">asio/compose.hpp</code>
|
||||
</p>
|
||||
<p>
|
||||
<span class="emphasis"><em>Convenience header: </em></span><code class="literal">asio.hpp</code>
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="async_completion/result.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="async_connect.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,151 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>async_connect</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="async_compose.html" title="async_compose">
|
||||
<link rel="next" href="async_connect/overload1.html" title="async_connect (1 of 6 overloads)">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="async_compose.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="async_connect/overload1.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.async_connect"></a><a class="link" href="async_connect.html" title="async_connect">async_connect</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
<a class="indexterm" name="asio.indexterm.async_connect"></a>
|
||||
The <code class="computeroutput">async_connect</code> function
|
||||
is a composed asynchronous operation that establishes a socket connection
|
||||
by trying each endpoint in a sequence.
|
||||
</p>
|
||||
<p>
|
||||
Asynchronously establishes a socket connection by trying each endpoint in
|
||||
a sequence.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename <a class="link" href="Protocol.html" title="Protocol requirements">Protocol</a>,
|
||||
typename <a class="link" href="Executor1.html" title="Executor requirements">Executor</a>,
|
||||
typename <a class="link" href="EndpointSequence.html" title="Endpoint sequence requirements">EndpointSequence</a>,
|
||||
typename <a class="link" href="RangeConnectHandler.html" title="Range connect handler requirements">RangeConnectHandler</a> = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> <a class="link" href="async_connect/overload1.html" title="async_connect (1 of 6 overloads)">async_connect</a>(
|
||||
basic_socket< Protocol, Executor > & s,
|
||||
const EndpointSequence & endpoints,
|
||||
RangeConnectHandler && handler = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>,
|
||||
typename enable_if< is_endpoint_sequence< EndpointSequence >::value >::type * = 0);
|
||||
<span class="emphasis"><em>» <a class="link" href="async_connect/overload1.html" title="async_connect (1 of 6 overloads)">more...</a></em></span>
|
||||
</pre>
|
||||
<p>
|
||||
(Deprecated: Use range overload.) Asynchronously establishes a socket connection
|
||||
by trying each endpoint in a sequence.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename <a class="link" href="Protocol.html" title="Protocol requirements">Protocol</a>,
|
||||
typename <a class="link" href="Executor1.html" title="Executor requirements">Executor</a>,
|
||||
typename Iterator,
|
||||
typename <a class="link" href="IteratorConnectHandler.html" title="Iterator connect handler requirements">IteratorConnectHandler</a> = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> <a class="link" href="async_connect/overload2.html" title="async_connect (2 of 6 overloads)">async_connect</a>(
|
||||
basic_socket< Protocol, Executor > & s,
|
||||
Iterator begin,
|
||||
IteratorConnectHandler && handler = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>,
|
||||
typename enable_if<!is_endpoint_sequence< Iterator >::value >::type * = 0);
|
||||
<span class="emphasis"><em>» <a class="link" href="async_connect/overload2.html" title="async_connect (2 of 6 overloads)">more...</a></em></span>
|
||||
</pre>
|
||||
<p>
|
||||
Asynchronously establishes a socket connection by trying each endpoint in
|
||||
a sequence.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename <a class="link" href="Protocol.html" title="Protocol requirements">Protocol</a>,
|
||||
typename <a class="link" href="Executor1.html" title="Executor requirements">Executor</a>,
|
||||
typename Iterator,
|
||||
typename <a class="link" href="IteratorConnectHandler.html" title="Iterator connect handler requirements">IteratorConnectHandler</a> = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> <a class="link" href="async_connect/overload3.html" title="async_connect (3 of 6 overloads)">async_connect</a>(
|
||||
basic_socket< Protocol, Executor > & s,
|
||||
Iterator begin,
|
||||
Iterator end,
|
||||
IteratorConnectHandler && handler = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>);
|
||||
<span class="emphasis"><em>» <a class="link" href="async_connect/overload3.html" title="async_connect (3 of 6 overloads)">more...</a></em></span>
|
||||
|
||||
template<
|
||||
typename <a class="link" href="Protocol.html" title="Protocol requirements">Protocol</a>,
|
||||
typename <a class="link" href="Executor1.html" title="Executor requirements">Executor</a>,
|
||||
typename <a class="link" href="EndpointSequence.html" title="Endpoint sequence requirements">EndpointSequence</a>,
|
||||
typename <a class="link" href="ConnectCondition.html" title="Connect condition requirements">ConnectCondition</a>,
|
||||
typename <a class="link" href="RangeConnectHandler.html" title="Range connect handler requirements">RangeConnectHandler</a> = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> <a class="link" href="async_connect/overload4.html" title="async_connect (4 of 6 overloads)">async_connect</a>(
|
||||
basic_socket< Protocol, Executor > & s,
|
||||
const EndpointSequence & endpoints,
|
||||
ConnectCondition connect_condition,
|
||||
RangeConnectHandler && handler = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>,
|
||||
typename enable_if< is_endpoint_sequence< EndpointSequence >::value >::type * = 0);
|
||||
<span class="emphasis"><em>» <a class="link" href="async_connect/overload4.html" title="async_connect (4 of 6 overloads)">more...</a></em></span>
|
||||
</pre>
|
||||
<p>
|
||||
(Deprecated: Use range overload.) Asynchronously establishes a socket connection
|
||||
by trying each endpoint in a sequence.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename <a class="link" href="Protocol.html" title="Protocol requirements">Protocol</a>,
|
||||
typename <a class="link" href="Executor1.html" title="Executor requirements">Executor</a>,
|
||||
typename Iterator,
|
||||
typename <a class="link" href="ConnectCondition.html" title="Connect condition requirements">ConnectCondition</a>,
|
||||
typename <a class="link" href="IteratorConnectHandler.html" title="Iterator connect handler requirements">IteratorConnectHandler</a> = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> <a class="link" href="async_connect/overload5.html" title="async_connect (5 of 6 overloads)">async_connect</a>(
|
||||
basic_socket< Protocol, Executor > & s,
|
||||
Iterator begin,
|
||||
ConnectCondition connect_condition,
|
||||
IteratorConnectHandler && handler = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>,
|
||||
typename enable_if<!is_endpoint_sequence< Iterator >::value >::type * = 0);
|
||||
<span class="emphasis"><em>» <a class="link" href="async_connect/overload5.html" title="async_connect (5 of 6 overloads)">more...</a></em></span>
|
||||
</pre>
|
||||
<p>
|
||||
Asynchronously establishes a socket connection by trying each endpoint in
|
||||
a sequence.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename <a class="link" href="Protocol.html" title="Protocol requirements">Protocol</a>,
|
||||
typename <a class="link" href="Executor1.html" title="Executor requirements">Executor</a>,
|
||||
typename Iterator,
|
||||
typename <a class="link" href="ConnectCondition.html" title="Connect condition requirements">ConnectCondition</a>,
|
||||
typename <a class="link" href="IteratorConnectHandler.html" title="Iterator connect handler requirements">IteratorConnectHandler</a> = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> <a class="link" href="async_connect/overload6.html" title="async_connect (6 of 6 overloads)">async_connect</a>(
|
||||
basic_socket< Protocol, Executor > & s,
|
||||
Iterator begin,
|
||||
Iterator end,
|
||||
ConnectCondition connect_condition,
|
||||
IteratorConnectHandler && handler = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>);
|
||||
<span class="emphasis"><em>» <a class="link" href="async_connect/overload6.html" title="async_connect (6 of 6 overloads)">more...</a></em></span>
|
||||
</pre>
|
||||
<h5>
|
||||
<a name="asio.reference.async_connect.h0"></a>
|
||||
<span><a name="asio.reference.async_connect.requirements"></a></span><a class="link" href="async_connect.html#asio.reference.async_connect.requirements">Requirements</a>
|
||||
</h5>
|
||||
<p>
|
||||
<span class="emphasis"><em>Header: </em></span><code class="literal">asio/connect.hpp</code>
|
||||
</p>
|
||||
<p>
|
||||
<span class="emphasis"><em>Convenience header: </em></span><code class="literal">asio.hpp</code>
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="async_compose.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="async_connect/overload1.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,135 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>async_connect (1 of 6 overloads)</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../async_connect.html" title="async_connect">
|
||||
<link rel="prev" href="../async_connect.html" title="async_connect">
|
||||
<link rel="next" href="overload2.html" title="async_connect (2 of 6 overloads)">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../async_connect.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_connect.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="overload2.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.reference.async_connect.overload1"></a><a class="link" href="overload1.html" title="async_connect (1 of 6 overloads)">async_connect
|
||||
(1 of 6 overloads)</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Asynchronously establishes a socket connection by trying each endpoint
|
||||
in a sequence.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename <a class="link" href="../Protocol.html" title="Protocol requirements">Protocol</a>,
|
||||
typename <a class="link" href="../Executor1.html" title="Executor requirements">Executor</a>,
|
||||
typename <a class="link" href="../EndpointSequence.html" title="Endpoint sequence requirements">EndpointSequence</a>,
|
||||
typename <a class="link" href="../RangeConnectHandler.html" title="Range connect handler requirements">RangeConnectHandler</a> = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> async_connect(
|
||||
basic_socket< Protocol, Executor > & s,
|
||||
const EndpointSequence & endpoints,
|
||||
RangeConnectHandler && handler = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>,
|
||||
typename enable_if< is_endpoint_sequence< EndpointSequence >::value >::type * = 0);
|
||||
</pre>
|
||||
<p>
|
||||
This function attempts to connect a socket to one of a sequence of endpoints.
|
||||
It does this by repeated calls to the socket's <code class="computeroutput">async_connect</code>
|
||||
member function, once for each endpoint in the sequence, until a connection
|
||||
is successfully established.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.reference.async_connect.overload1.h0"></a>
|
||||
<span><a name="asio.reference.async_connect.overload1.parameters"></a></span><a class="link" href="overload1.html#asio.reference.async_connect.overload1.parameters">Parameters</a>
|
||||
</h6>
|
||||
<div class="variablelist">
|
||||
<p class="title"><b></b></p>
|
||||
<dl>
|
||||
<dt><span class="term">s</span></dt>
|
||||
<dd><p>
|
||||
The socket to be connected. If the socket is already open, it will
|
||||
be closed.
|
||||
</p></dd>
|
||||
<dt><span class="term">endpoints</span></dt>
|
||||
<dd><p>
|
||||
A sequence of endpoints.
|
||||
</p></dd>
|
||||
<dt><span class="term">handler</span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
The handler to be called when the connect operation completes. Copies
|
||||
will be made of the handler as required. The function signature of
|
||||
the handler must be:
|
||||
</p>
|
||||
<pre class="programlisting">void handler(
|
||||
// Result of operation. if the sequence is empty, set to
|
||||
// asio::error::not_found. Otherwise, contains the
|
||||
// error from the last connection attempt.
|
||||
const asio::error_code& error,
|
||||
|
||||
// On success, the successfully connected endpoint.
|
||||
// Otherwise, a default-constructed endpoint.
|
||||
const typename Protocol::endpoint& endpoint
|
||||
);
|
||||
</pre>
|
||||
<p>
|
||||
Regardless of whether the asynchronous operation completes immediately
|
||||
or not, the handler will not be invoked from within this function.
|
||||
On immediate completion, invocation of the handler will be performed
|
||||
in a manner equivalent to using <a class="link" href="../post.html" title="post"><code class="computeroutput">post</code></a>.
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<h6>
|
||||
<a name="asio.reference.async_connect.overload1.h1"></a>
|
||||
<span><a name="asio.reference.async_connect.overload1.example"></a></span><a class="link" href="overload1.html#asio.reference.async_connect.overload1.example">Example</a>
|
||||
</h6>
|
||||
<pre class="programlisting">tcp::resolver r(my_context);
|
||||
tcp::resolver::query q("host", "service");
|
||||
tcp::socket s(my_context);
|
||||
|
||||
// ...
|
||||
|
||||
r.async_resolve(q, resolve_handler);
|
||||
|
||||
// ...
|
||||
|
||||
void resolve_handler(
|
||||
const asio::error_code& ec,
|
||||
tcp::resolver::results_type results)
|
||||
{
|
||||
if (!ec)
|
||||
{
|
||||
asio::async_connect(s, results, connect_handler);
|
||||
}
|
||||
}
|
||||
|
||||
// ...
|
||||
|
||||
void connect_handler(
|
||||
const asio::error_code& ec,
|
||||
const tcp::endpoint& endpoint)
|
||||
{
|
||||
// ...
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../async_connect.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_connect.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="overload2.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,111 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>async_connect (2 of 6 overloads)</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../async_connect.html" title="async_connect">
|
||||
<link rel="prev" href="overload1.html" title="async_connect (1 of 6 overloads)">
|
||||
<link rel="next" href="overload3.html" title="async_connect (3 of 6 overloads)">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload1.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_connect.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="overload3.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.reference.async_connect.overload2"></a><a class="link" href="overload2.html" title="async_connect (2 of 6 overloads)">async_connect
|
||||
(2 of 6 overloads)</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
(Deprecated: Use range overload.) Asynchronously establishes a socket connection
|
||||
by trying each endpoint in a sequence.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename <a class="link" href="../Protocol.html" title="Protocol requirements">Protocol</a>,
|
||||
typename <a class="link" href="../Executor1.html" title="Executor requirements">Executor</a>,
|
||||
typename Iterator,
|
||||
typename <a class="link" href="../IteratorConnectHandler.html" title="Iterator connect handler requirements">IteratorConnectHandler</a> = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> async_connect(
|
||||
basic_socket< Protocol, Executor > & s,
|
||||
Iterator begin,
|
||||
IteratorConnectHandler && handler = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>,
|
||||
typename enable_if<!is_endpoint_sequence< Iterator >::value >::type * = 0);
|
||||
</pre>
|
||||
<p>
|
||||
This function attempts to connect a socket to one of a sequence of endpoints.
|
||||
It does this by repeated calls to the socket's <code class="computeroutput">async_connect</code>
|
||||
member function, once for each endpoint in the sequence, until a connection
|
||||
is successfully established.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.reference.async_connect.overload2.h0"></a>
|
||||
<span><a name="asio.reference.async_connect.overload2.parameters"></a></span><a class="link" href="overload2.html#asio.reference.async_connect.overload2.parameters">Parameters</a>
|
||||
</h6>
|
||||
<div class="variablelist">
|
||||
<p class="title"><b></b></p>
|
||||
<dl>
|
||||
<dt><span class="term">s</span></dt>
|
||||
<dd><p>
|
||||
The socket to be connected. If the socket is already open, it will
|
||||
be closed.
|
||||
</p></dd>
|
||||
<dt><span class="term">begin</span></dt>
|
||||
<dd><p>
|
||||
An iterator pointing to the start of a sequence of endpoints.
|
||||
</p></dd>
|
||||
<dt><span class="term">handler</span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
The handler to be called when the connect operation completes. Copies
|
||||
will be made of the handler as required. The function signature of
|
||||
the handler must be:
|
||||
</p>
|
||||
<pre class="programlisting">void handler(
|
||||
// Result of operation. if the sequence is empty, set to
|
||||
// asio::error::not_found. Otherwise, contains the
|
||||
// error from the last connection attempt.
|
||||
const asio::error_code& error,
|
||||
|
||||
// On success, an iterator denoting the successfully
|
||||
// connected endpoint. Otherwise, the end iterator.
|
||||
Iterator iterator
|
||||
);
|
||||
</pre>
|
||||
<p>
|
||||
Regardless of whether the asynchronous operation completes immediately
|
||||
or not, the handler will not be invoked from within this function.
|
||||
On immediate completion, invocation of the handler will be performed
|
||||
in a manner equivalent to using <a class="link" href="../post.html" title="post"><code class="computeroutput">post</code></a>.
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<h6>
|
||||
<a name="asio.reference.async_connect.overload2.h1"></a>
|
||||
<span><a name="asio.reference.async_connect.overload2.remarks"></a></span><a class="link" href="overload2.html#asio.reference.async_connect.overload2.remarks">Remarks</a>
|
||||
</h6>
|
||||
<p>
|
||||
This overload assumes that a default constructed object of type <code class="computeroutput">Iterator</code>
|
||||
represents the end of the sequence. This is a valid assumption for iterator
|
||||
types such as <code class="computeroutput">asio::ip::tcp::resolver::iterator</code>.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload1.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_connect.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="overload3.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,125 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>async_connect (3 of 6 overloads)</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../async_connect.html" title="async_connect">
|
||||
<link rel="prev" href="overload2.html" title="async_connect (2 of 6 overloads)">
|
||||
<link rel="next" href="overload4.html" title="async_connect (4 of 6 overloads)">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload2.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_connect.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="overload4.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.reference.async_connect.overload3"></a><a class="link" href="overload3.html" title="async_connect (3 of 6 overloads)">async_connect
|
||||
(3 of 6 overloads)</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Asynchronously establishes a socket connection by trying each endpoint
|
||||
in a sequence.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename <a class="link" href="../Protocol.html" title="Protocol requirements">Protocol</a>,
|
||||
typename <a class="link" href="../Executor1.html" title="Executor requirements">Executor</a>,
|
||||
typename Iterator,
|
||||
typename <a class="link" href="../IteratorConnectHandler.html" title="Iterator connect handler requirements">IteratorConnectHandler</a> = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> async_connect(
|
||||
basic_socket< Protocol, Executor > & s,
|
||||
Iterator begin,
|
||||
Iterator end,
|
||||
IteratorConnectHandler && handler = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>);
|
||||
</pre>
|
||||
<p>
|
||||
This function attempts to connect a socket to one of a sequence of endpoints.
|
||||
It does this by repeated calls to the socket's <code class="computeroutput">async_connect</code>
|
||||
member function, once for each endpoint in the sequence, until a connection
|
||||
is successfully established.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.reference.async_connect.overload3.h0"></a>
|
||||
<span><a name="asio.reference.async_connect.overload3.parameters"></a></span><a class="link" href="overload3.html#asio.reference.async_connect.overload3.parameters">Parameters</a>
|
||||
</h6>
|
||||
<div class="variablelist">
|
||||
<p class="title"><b></b></p>
|
||||
<dl>
|
||||
<dt><span class="term">s</span></dt>
|
||||
<dd><p>
|
||||
The socket to be connected. If the socket is already open, it will
|
||||
be closed.
|
||||
</p></dd>
|
||||
<dt><span class="term">begin</span></dt>
|
||||
<dd><p>
|
||||
An iterator pointing to the start of a sequence of endpoints.
|
||||
</p></dd>
|
||||
<dt><span class="term">end</span></dt>
|
||||
<dd><p>
|
||||
An iterator pointing to the end of a sequence of endpoints.
|
||||
</p></dd>
|
||||
<dt><span class="term">handler</span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
The handler to be called when the connect operation completes. Copies
|
||||
will be made of the handler as required. The function signature of
|
||||
the handler must be:
|
||||
</p>
|
||||
<pre class="programlisting">void handler(
|
||||
// Result of operation. if the sequence is empty, set to
|
||||
// asio::error::not_found. Otherwise, contains the
|
||||
// error from the last connection attempt.
|
||||
const asio::error_code& error,
|
||||
|
||||
// On success, an iterator denoting the successfully
|
||||
// connected endpoint. Otherwise, the end iterator.
|
||||
Iterator iterator
|
||||
);
|
||||
</pre>
|
||||
<p>
|
||||
Regardless of whether the asynchronous operation completes immediately
|
||||
or not, the handler will not be invoked from within this function.
|
||||
On immediate completion, invocation of the handler will be performed
|
||||
in a manner equivalent to using <a class="link" href="../post.html" title="post"><code class="computeroutput">post</code></a>.
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<h6>
|
||||
<a name="asio.reference.async_connect.overload3.h1"></a>
|
||||
<span><a name="asio.reference.async_connect.overload3.example"></a></span><a class="link" href="overload3.html#asio.reference.async_connect.overload3.example">Example</a>
|
||||
</h6>
|
||||
<pre class="programlisting">std::vector<tcp::endpoint> endpoints = ...;
|
||||
tcp::socket s(my_context);
|
||||
asio::async_connect(s,
|
||||
endpoints.begin(), endpoints.end(),
|
||||
connect_handler);
|
||||
|
||||
// ...
|
||||
|
||||
void connect_handler(
|
||||
const asio::error_code& ec,
|
||||
std::vector<tcp::endpoint>::iterator i)
|
||||
{
|
||||
// ...
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload2.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_connect.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="overload4.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,184 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>async_connect (4 of 6 overloads)</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../async_connect.html" title="async_connect">
|
||||
<link rel="prev" href="overload3.html" title="async_connect (3 of 6 overloads)">
|
||||
<link rel="next" href="overload5.html" title="async_connect (5 of 6 overloads)">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload3.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_connect.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="overload5.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.reference.async_connect.overload4"></a><a class="link" href="overload4.html" title="async_connect (4 of 6 overloads)">async_connect
|
||||
(4 of 6 overloads)</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Asynchronously establishes a socket connection by trying each endpoint
|
||||
in a sequence.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename <a class="link" href="../Protocol.html" title="Protocol requirements">Protocol</a>,
|
||||
typename <a class="link" href="../Executor1.html" title="Executor requirements">Executor</a>,
|
||||
typename <a class="link" href="../EndpointSequence.html" title="Endpoint sequence requirements">EndpointSequence</a>,
|
||||
typename <a class="link" href="../ConnectCondition.html" title="Connect condition requirements">ConnectCondition</a>,
|
||||
typename <a class="link" href="../RangeConnectHandler.html" title="Range connect handler requirements">RangeConnectHandler</a> = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> async_connect(
|
||||
basic_socket< Protocol, Executor > & s,
|
||||
const EndpointSequence & endpoints,
|
||||
ConnectCondition connect_condition,
|
||||
RangeConnectHandler && handler = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>,
|
||||
typename enable_if< is_endpoint_sequence< EndpointSequence >::value >::type * = 0);
|
||||
</pre>
|
||||
<p>
|
||||
This function attempts to connect a socket to one of a sequence of endpoints.
|
||||
It does this by repeated calls to the socket's <code class="computeroutput">async_connect</code>
|
||||
member function, once for each endpoint in the sequence, until a connection
|
||||
is successfully established.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.reference.async_connect.overload4.h0"></a>
|
||||
<span><a name="asio.reference.async_connect.overload4.parameters"></a></span><a class="link" href="overload4.html#asio.reference.async_connect.overload4.parameters">Parameters</a>
|
||||
</h6>
|
||||
<div class="variablelist">
|
||||
<p class="title"><b></b></p>
|
||||
<dl>
|
||||
<dt><span class="term">s</span></dt>
|
||||
<dd><p>
|
||||
The socket to be connected. If the socket is already open, it will
|
||||
be closed.
|
||||
</p></dd>
|
||||
<dt><span class="term">endpoints</span></dt>
|
||||
<dd><p>
|
||||
A sequence of endpoints.
|
||||
</p></dd>
|
||||
<dt><span class="term">connect_condition</span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
A function object that is called prior to each connection attempt.
|
||||
The signature of the function object must be:
|
||||
</p>
|
||||
<pre class="programlisting">bool connect_condition(
|
||||
const asio::error_code& ec,
|
||||
const typename Protocol::endpoint& next);
|
||||
</pre>
|
||||
<p>
|
||||
The <code class="computeroutput">ec</code> parameter contains the result from the most recent
|
||||
connect operation. Before the first connection attempt, <code class="computeroutput">ec</code>
|
||||
is always set to indicate success. The <code class="computeroutput">next</code> parameter
|
||||
is the next endpoint to be tried. The function object should return
|
||||
true if the next endpoint should be tried, and false if it should
|
||||
be skipped.
|
||||
</p>
|
||||
</dd>
|
||||
<dt><span class="term">handler</span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
The handler to be called when the connect operation completes. Copies
|
||||
will be made of the handler as required. The function signature of
|
||||
the handler must be:
|
||||
</p>
|
||||
<pre class="programlisting">void handler(
|
||||
// Result of operation. if the sequence is empty, set to
|
||||
// asio::error::not_found. Otherwise, contains the
|
||||
// error from the last connection attempt.
|
||||
const asio::error_code& error,
|
||||
|
||||
// On success, an iterator denoting the successfully
|
||||
// connected endpoint. Otherwise, the end iterator.
|
||||
Iterator iterator
|
||||
);
|
||||
</pre>
|
||||
<p>
|
||||
Regardless of whether the asynchronous operation completes immediately
|
||||
or not, the handler will not be invoked from within this function.
|
||||
On immediate completion, invocation of the handler will be performed
|
||||
in a manner equivalent to using <a class="link" href="../post.html" title="post"><code class="computeroutput">post</code></a>.
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<h6>
|
||||
<a name="asio.reference.async_connect.overload4.h1"></a>
|
||||
<span><a name="asio.reference.async_connect.overload4.example"></a></span><a class="link" href="overload4.html#asio.reference.async_connect.overload4.example">Example</a>
|
||||
</h6>
|
||||
<p>
|
||||
The following connect condition function object can be used to output information
|
||||
about the individual connection attempts:
|
||||
</p>
|
||||
<pre class="programlisting">struct my_connect_condition
|
||||
{
|
||||
bool operator()(
|
||||
const asio::error_code& ec,
|
||||
const::tcp::endpoint& next)
|
||||
{
|
||||
if (ec) std::cout << "Error: " << ec.message() << std::endl;
|
||||
std::cout << "Trying: " << next << std::endl;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
</pre>
|
||||
<p>
|
||||
It would be used with the <code class="computeroutput">asio::connect</code> function as follows:
|
||||
</p>
|
||||
<pre class="programlisting">tcp::resolver r(my_context);
|
||||
tcp::resolver::query q("host", "service");
|
||||
tcp::socket s(my_context);
|
||||
|
||||
// ...
|
||||
|
||||
r.async_resolve(q, resolve_handler);
|
||||
|
||||
// ...
|
||||
|
||||
void resolve_handler(
|
||||
const asio::error_code& ec,
|
||||
tcp::resolver::results_type results)
|
||||
{
|
||||
if (!ec)
|
||||
{
|
||||
asio::async_connect(s, results,
|
||||
my_connect_condition(),
|
||||
connect_handler);
|
||||
}
|
||||
}
|
||||
|
||||
// ...
|
||||
|
||||
void connect_handler(
|
||||
const asio::error_code& ec,
|
||||
const tcp::endpoint& endpoint)
|
||||
{
|
||||
if (ec)
|
||||
{
|
||||
// An error occurred.
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Connected to: " << endpoint << std::endl;
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload3.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_connect.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="overload5.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,132 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>async_connect (5 of 6 overloads)</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../async_connect.html" title="async_connect">
|
||||
<link rel="prev" href="overload4.html" title="async_connect (4 of 6 overloads)">
|
||||
<link rel="next" href="overload6.html" title="async_connect (6 of 6 overloads)">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload4.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_connect.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="overload6.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.reference.async_connect.overload5"></a><a class="link" href="overload5.html" title="async_connect (5 of 6 overloads)">async_connect
|
||||
(5 of 6 overloads)</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
(Deprecated: Use range overload.) Asynchronously establishes a socket connection
|
||||
by trying each endpoint in a sequence.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename <a class="link" href="../Protocol.html" title="Protocol requirements">Protocol</a>,
|
||||
typename <a class="link" href="../Executor1.html" title="Executor requirements">Executor</a>,
|
||||
typename Iterator,
|
||||
typename <a class="link" href="../ConnectCondition.html" title="Connect condition requirements">ConnectCondition</a>,
|
||||
typename <a class="link" href="../IteratorConnectHandler.html" title="Iterator connect handler requirements">IteratorConnectHandler</a> = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> async_connect(
|
||||
basic_socket< Protocol, Executor > & s,
|
||||
Iterator begin,
|
||||
ConnectCondition connect_condition,
|
||||
IteratorConnectHandler && handler = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>,
|
||||
typename enable_if<!is_endpoint_sequence< Iterator >::value >::type * = 0);
|
||||
</pre>
|
||||
<p>
|
||||
This function attempts to connect a socket to one of a sequence of endpoints.
|
||||
It does this by repeated calls to the socket's <code class="computeroutput">async_connect</code>
|
||||
member function, once for each endpoint in the sequence, until a connection
|
||||
is successfully established.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.reference.async_connect.overload5.h0"></a>
|
||||
<span><a name="asio.reference.async_connect.overload5.parameters"></a></span><a class="link" href="overload5.html#asio.reference.async_connect.overload5.parameters">Parameters</a>
|
||||
</h6>
|
||||
<div class="variablelist">
|
||||
<p class="title"><b></b></p>
|
||||
<dl>
|
||||
<dt><span class="term">s</span></dt>
|
||||
<dd><p>
|
||||
The socket to be connected. If the socket is already open, it will
|
||||
be closed.
|
||||
</p></dd>
|
||||
<dt><span class="term">begin</span></dt>
|
||||
<dd><p>
|
||||
An iterator pointing to the start of a sequence of endpoints.
|
||||
</p></dd>
|
||||
<dt><span class="term">connect_condition</span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
A function object that is called prior to each connection attempt.
|
||||
The signature of the function object must be:
|
||||
</p>
|
||||
<pre class="programlisting">bool connect_condition(
|
||||
const asio::error_code& ec,
|
||||
const typename Protocol::endpoint& next);
|
||||
</pre>
|
||||
<p>
|
||||
The <code class="computeroutput">ec</code> parameter contains the result from the most recent
|
||||
connect operation. Before the first connection attempt, <code class="computeroutput">ec</code>
|
||||
is always set to indicate success. The <code class="computeroutput">next</code> parameter
|
||||
is the next endpoint to be tried. The function object should return
|
||||
true if the next endpoint should be tried, and false if it should
|
||||
be skipped.
|
||||
</p>
|
||||
</dd>
|
||||
<dt><span class="term">handler</span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
The handler to be called when the connect operation completes. Copies
|
||||
will be made of the handler as required. The function signature of
|
||||
the handler must be:
|
||||
</p>
|
||||
<pre class="programlisting">void handler(
|
||||
// Result of operation. if the sequence is empty, set to
|
||||
// asio::error::not_found. Otherwise, contains the
|
||||
// error from the last connection attempt.
|
||||
const asio::error_code& error,
|
||||
|
||||
// On success, an iterator denoting the successfully
|
||||
// connected endpoint. Otherwise, the end iterator.
|
||||
Iterator iterator
|
||||
);
|
||||
</pre>
|
||||
<p>
|
||||
Regardless of whether the asynchronous operation completes immediately
|
||||
or not, the handler will not be invoked from within this function.
|
||||
On immediate completion, invocation of the handler will be performed
|
||||
in a manner equivalent to using <a class="link" href="../post.html" title="post"><code class="computeroutput">post</code></a>.
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<h6>
|
||||
<a name="asio.reference.async_connect.overload5.h1"></a>
|
||||
<span><a name="asio.reference.async_connect.overload5.remarks"></a></span><a class="link" href="overload5.html#asio.reference.async_connect.overload5.remarks">Remarks</a>
|
||||
</h6>
|
||||
<p>
|
||||
This overload assumes that a default constructed object of type <code class="computeroutput">Iterator</code>
|
||||
represents the end of the sequence. This is a valid assumption for iterator
|
||||
types such as <code class="computeroutput">asio::ip::tcp::resolver::iterator</code>.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload4.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_connect.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="overload6.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,189 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>async_connect (6 of 6 overloads)</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../async_connect.html" title="async_connect">
|
||||
<link rel="prev" href="overload5.html" title="async_connect (5 of 6 overloads)">
|
||||
<link rel="next" href="../async_initiate.html" title="async_initiate">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload5.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_connect.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="../async_initiate.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.reference.async_connect.overload6"></a><a class="link" href="overload6.html" title="async_connect (6 of 6 overloads)">async_connect
|
||||
(6 of 6 overloads)</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Asynchronously establishes a socket connection by trying each endpoint
|
||||
in a sequence.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename <a class="link" href="../Protocol.html" title="Protocol requirements">Protocol</a>,
|
||||
typename <a class="link" href="../Executor1.html" title="Executor requirements">Executor</a>,
|
||||
typename Iterator,
|
||||
typename <a class="link" href="../ConnectCondition.html" title="Connect condition requirements">ConnectCondition</a>,
|
||||
typename <a class="link" href="../IteratorConnectHandler.html" title="Iterator connect handler requirements">IteratorConnectHandler</a> = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> async_connect(
|
||||
basic_socket< Protocol, Executor > & s,
|
||||
Iterator begin,
|
||||
Iterator end,
|
||||
ConnectCondition connect_condition,
|
||||
IteratorConnectHandler && handler = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>);
|
||||
</pre>
|
||||
<p>
|
||||
This function attempts to connect a socket to one of a sequence of endpoints.
|
||||
It does this by repeated calls to the socket's <code class="computeroutput">async_connect</code>
|
||||
member function, once for each endpoint in the sequence, until a connection
|
||||
is successfully established.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.reference.async_connect.overload6.h0"></a>
|
||||
<span><a name="asio.reference.async_connect.overload6.parameters"></a></span><a class="link" href="overload6.html#asio.reference.async_connect.overload6.parameters">Parameters</a>
|
||||
</h6>
|
||||
<div class="variablelist">
|
||||
<p class="title"><b></b></p>
|
||||
<dl>
|
||||
<dt><span class="term">s</span></dt>
|
||||
<dd><p>
|
||||
The socket to be connected. If the socket is already open, it will
|
||||
be closed.
|
||||
</p></dd>
|
||||
<dt><span class="term">begin</span></dt>
|
||||
<dd><p>
|
||||
An iterator pointing to the start of a sequence of endpoints.
|
||||
</p></dd>
|
||||
<dt><span class="term">end</span></dt>
|
||||
<dd><p>
|
||||
An iterator pointing to the end of a sequence of endpoints.
|
||||
</p></dd>
|
||||
<dt><span class="term">connect_condition</span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
A function object that is called prior to each connection attempt.
|
||||
The signature of the function object must be:
|
||||
</p>
|
||||
<pre class="programlisting">bool connect_condition(
|
||||
const asio::error_code& ec,
|
||||
const typename Protocol::endpoint& next);
|
||||
</pre>
|
||||
<p>
|
||||
The <code class="computeroutput">ec</code> parameter contains the result from the most recent
|
||||
connect operation. Before the first connection attempt, <code class="computeroutput">ec</code>
|
||||
is always set to indicate success. The <code class="computeroutput">next</code> parameter
|
||||
is the next endpoint to be tried. The function object should return
|
||||
true if the next endpoint should be tried, and false if it should
|
||||
be skipped.
|
||||
</p>
|
||||
</dd>
|
||||
<dt><span class="term">handler</span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
The handler to be called when the connect operation completes. Copies
|
||||
will be made of the handler as required. The function signature of
|
||||
the handler must be:
|
||||
</p>
|
||||
<pre class="programlisting">void handler(
|
||||
// Result of operation. if the sequence is empty, set to
|
||||
// asio::error::not_found. Otherwise, contains the
|
||||
// error from the last connection attempt.
|
||||
const asio::error_code& error,
|
||||
|
||||
// On success, an iterator denoting the successfully
|
||||
// connected endpoint. Otherwise, the end iterator.
|
||||
Iterator iterator
|
||||
);
|
||||
</pre>
|
||||
<p>
|
||||
Regardless of whether the asynchronous operation completes immediately
|
||||
or not, the handler will not be invoked from within this function.
|
||||
On immediate completion, invocation of the handler will be performed
|
||||
in a manner equivalent to using <a class="link" href="../post.html" title="post"><code class="computeroutput">post</code></a>.
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<h6>
|
||||
<a name="asio.reference.async_connect.overload6.h1"></a>
|
||||
<span><a name="asio.reference.async_connect.overload6.example"></a></span><a class="link" href="overload6.html#asio.reference.async_connect.overload6.example">Example</a>
|
||||
</h6>
|
||||
<p>
|
||||
The following connect condition function object can be used to output information
|
||||
about the individual connection attempts:
|
||||
</p>
|
||||
<pre class="programlisting">struct my_connect_condition
|
||||
{
|
||||
bool operator()(
|
||||
const asio::error_code& ec,
|
||||
const::tcp::endpoint& next)
|
||||
{
|
||||
if (ec) std::cout << "Error: " << ec.message() << std::endl;
|
||||
std::cout << "Trying: " << next << std::endl;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
</pre>
|
||||
<p>
|
||||
It would be used with the <code class="computeroutput">asio::connect</code> function as follows:
|
||||
</p>
|
||||
<pre class="programlisting">tcp::resolver r(my_context);
|
||||
tcp::resolver::query q("host", "service");
|
||||
tcp::socket s(my_context);
|
||||
|
||||
// ...
|
||||
|
||||
r.async_resolve(q, resolve_handler);
|
||||
|
||||
// ...
|
||||
|
||||
void resolve_handler(
|
||||
const asio::error_code& ec,
|
||||
tcp::resolver::iterator i)
|
||||
{
|
||||
if (!ec)
|
||||
{
|
||||
tcp::resolver::iterator end;
|
||||
asio::async_connect(s, i, end,
|
||||
my_connect_condition(),
|
||||
connect_handler);
|
||||
}
|
||||
}
|
||||
|
||||
// ...
|
||||
|
||||
void connect_handler(
|
||||
const asio::error_code& ec,
|
||||
tcp::resolver::iterator i)
|
||||
{
|
||||
if (ec)
|
||||
{
|
||||
// An error occurred.
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Connected to: " << i->endpoint() << std::endl;
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload5.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_connect.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="../async_initiate.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,60 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>async_initiate</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="async_connect/overload6.html" title="async_connect (6 of 6 overloads)">
|
||||
<link rel="next" href="async_read.html" title="async_read">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="async_connect/overload6.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="async_read.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.async_initiate"></a><a class="link" href="async_initiate.html" title="async_initiate">async_initiate</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
<a class="indexterm" name="asio.indexterm.async_initiate"></a>
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename CompletionToken,
|
||||
completion_signature Signature,
|
||||
typename Initiation,
|
||||
typename... Args>
|
||||
<a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> async_initiate(
|
||||
Initiation && initiation,
|
||||
CompletionToken & ,
|
||||
Args &&... args);
|
||||
</pre>
|
||||
<h5>
|
||||
<a name="asio.reference.async_initiate.h0"></a>
|
||||
<span><a name="asio.reference.async_initiate.requirements"></a></span><a class="link" href="async_initiate.html#asio.reference.async_initiate.requirements">Requirements</a>
|
||||
</h5>
|
||||
<p>
|
||||
<span class="emphasis"><em>Header: </em></span><code class="literal">asio/async_result.hpp</code>
|
||||
</p>
|
||||
<p>
|
||||
<span class="emphasis"><em>Convenience header: </em></span><code class="literal">asio.hpp</code>
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="async_connect/overload6.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="async_read.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,150 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>async_read</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="async_initiate.html" title="async_initiate">
|
||||
<link rel="next" href="async_read/overload1.html" title="async_read (1 of 8 overloads)">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="async_initiate.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="async_read/overload1.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.async_read"></a><a class="link" href="async_read.html" title="async_read">async_read</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
<a class="indexterm" name="asio.indexterm.async_read"></a>
|
||||
The <code class="computeroutput">async_read</code> function is
|
||||
a composed asynchronous operation that reads a certain amount of data from
|
||||
a stream before completion.
|
||||
</p>
|
||||
<p>
|
||||
Start an asynchronous operation to read a certain amount of data from a stream.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename <a class="link" href="AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">AsyncReadStream</a>,
|
||||
typename <a class="link" href="MutableBufferSequence.html" title="Mutable buffer sequence requirements">MutableBufferSequence</a>,
|
||||
typename <a class="link" href="ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> <a class="link" href="async_read/overload1.html" title="async_read (1 of 8 overloads)">async_read</a>(
|
||||
AsyncReadStream & s,
|
||||
const MutableBufferSequence & buffers,
|
||||
ReadHandler && handler = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>,
|
||||
typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type * = 0);
|
||||
<span class="emphasis"><em>» <a class="link" href="async_read/overload1.html" title="async_read (1 of 8 overloads)">more...</a></em></span>
|
||||
|
||||
template<
|
||||
typename <a class="link" href="AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">AsyncReadStream</a>,
|
||||
typename <a class="link" href="MutableBufferSequence.html" title="Mutable buffer sequence requirements">MutableBufferSequence</a>,
|
||||
typename <a class="link" href="CompletionCondition.html" title="Completion condition requirements">CompletionCondition</a>,
|
||||
typename <a class="link" href="ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> <a class="link" href="async_read/overload2.html" title="async_read (2 of 8 overloads)">async_read</a>(
|
||||
AsyncReadStream & s,
|
||||
const MutableBufferSequence & buffers,
|
||||
CompletionCondition completion_condition,
|
||||
ReadHandler && handler = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>,
|
||||
typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type * = 0);
|
||||
<span class="emphasis"><em>» <a class="link" href="async_read/overload2.html" title="async_read (2 of 8 overloads)">more...</a></em></span>
|
||||
|
||||
template<
|
||||
typename <a class="link" href="AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">AsyncReadStream</a>,
|
||||
typename <a class="link" href="DynamicBuffer_v1.html" title="Dynamic buffer requirements (version 1)">DynamicBuffer_v1</a>,
|
||||
typename <a class="link" href="ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> <a class="link" href="async_read/overload3.html" title="async_read (3 of 8 overloads)">async_read</a>(
|
||||
AsyncReadStream & s,
|
||||
DynamicBuffer_v1 && buffers,
|
||||
ReadHandler && handler = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>,
|
||||
typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
|
||||
<span class="emphasis"><em>» <a class="link" href="async_read/overload3.html" title="async_read (3 of 8 overloads)">more...</a></em></span>
|
||||
|
||||
template<
|
||||
typename <a class="link" href="AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">AsyncReadStream</a>,
|
||||
typename <a class="link" href="DynamicBuffer_v1.html" title="Dynamic buffer requirements (version 1)">DynamicBuffer_v1</a>,
|
||||
typename <a class="link" href="CompletionCondition.html" title="Completion condition requirements">CompletionCondition</a>,
|
||||
typename <a class="link" href="ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> <a class="link" href="async_read/overload4.html" title="async_read (4 of 8 overloads)">async_read</a>(
|
||||
AsyncReadStream & s,
|
||||
DynamicBuffer_v1 && buffers,
|
||||
CompletionCondition completion_condition,
|
||||
ReadHandler && handler = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>,
|
||||
typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
|
||||
<span class="emphasis"><em>» <a class="link" href="async_read/overload4.html" title="async_read (4 of 8 overloads)">more...</a></em></span>
|
||||
|
||||
template<
|
||||
typename <a class="link" href="AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">AsyncReadStream</a>,
|
||||
typename Allocator,
|
||||
typename <a class="link" href="ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> <a class="link" href="async_read/overload5.html" title="async_read (5 of 8 overloads)">async_read</a>(
|
||||
AsyncReadStream & s,
|
||||
basic_streambuf< Allocator > & b,
|
||||
ReadHandler && handler = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>);
|
||||
<span class="emphasis"><em>» <a class="link" href="async_read/overload5.html" title="async_read (5 of 8 overloads)">more...</a></em></span>
|
||||
|
||||
template<
|
||||
typename <a class="link" href="AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">AsyncReadStream</a>,
|
||||
typename Allocator,
|
||||
typename <a class="link" href="CompletionCondition.html" title="Completion condition requirements">CompletionCondition</a>,
|
||||
typename <a class="link" href="ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> <a class="link" href="async_read/overload6.html" title="async_read (6 of 8 overloads)">async_read</a>(
|
||||
AsyncReadStream & s,
|
||||
basic_streambuf< Allocator > & b,
|
||||
CompletionCondition completion_condition,
|
||||
ReadHandler && handler = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>);
|
||||
<span class="emphasis"><em>» <a class="link" href="async_read/overload6.html" title="async_read (6 of 8 overloads)">more...</a></em></span>
|
||||
|
||||
template<
|
||||
typename <a class="link" href="AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">AsyncReadStream</a>,
|
||||
typename <a class="link" href="DynamicBuffer_v2.html" title="Dynamic buffer requirements (version 2)">DynamicBuffer_v2</a>,
|
||||
typename <a class="link" href="ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> <a class="link" href="async_read/overload7.html" title="async_read (7 of 8 overloads)">async_read</a>(
|
||||
AsyncReadStream & s,
|
||||
DynamicBuffer_v2 buffers,
|
||||
ReadHandler && handler = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>,
|
||||
typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
|
||||
<span class="emphasis"><em>» <a class="link" href="async_read/overload7.html" title="async_read (7 of 8 overloads)">more...</a></em></span>
|
||||
|
||||
template<
|
||||
typename <a class="link" href="AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">AsyncReadStream</a>,
|
||||
typename <a class="link" href="DynamicBuffer_v2.html" title="Dynamic buffer requirements (version 2)">DynamicBuffer_v2</a>,
|
||||
typename <a class="link" href="CompletionCondition.html" title="Completion condition requirements">CompletionCondition</a>,
|
||||
typename <a class="link" href="ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> <a class="link" href="async_read/overload8.html" title="async_read (8 of 8 overloads)">async_read</a>(
|
||||
AsyncReadStream & s,
|
||||
DynamicBuffer_v2 buffers,
|
||||
CompletionCondition completion_condition,
|
||||
ReadHandler && handler = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>,
|
||||
typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
|
||||
<span class="emphasis"><em>» <a class="link" href="async_read/overload8.html" title="async_read (8 of 8 overloads)">more...</a></em></span>
|
||||
</pre>
|
||||
<h5>
|
||||
<a name="asio.reference.async_read.h0"></a>
|
||||
<span><a name="asio.reference.async_read.requirements"></a></span><a class="link" href="async_read.html#asio.reference.async_read.requirements">Requirements</a>
|
||||
</h5>
|
||||
<p>
|
||||
<span class="emphasis"><em>Header: </em></span><code class="literal">asio/read.hpp</code>
|
||||
</p>
|
||||
<p>
|
||||
<span class="emphasis"><em>Convenience header: </em></span><code class="literal">asio.hpp</code>
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="async_initiate.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="async_read/overload1.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,148 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>async_read (1 of 8 overloads)</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../async_read.html" title="async_read">
|
||||
<link rel="prev" href="../async_read.html" title="async_read">
|
||||
<link rel="next" href="overload2.html" title="async_read (2 of 8 overloads)">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../async_read.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_read.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="overload2.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.reference.async_read.overload1"></a><a class="link" href="overload1.html" title="async_read (1 of 8 overloads)">async_read (1
|
||||
of 8 overloads)</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Start an asynchronous operation to read a certain amount of data from a
|
||||
stream.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename <a class="link" href="../AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">AsyncReadStream</a>,
|
||||
typename <a class="link" href="../MutableBufferSequence.html" title="Mutable buffer sequence requirements">MutableBufferSequence</a>,
|
||||
typename <a class="link" href="../ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> async_read(
|
||||
AsyncReadStream & s,
|
||||
const MutableBufferSequence & buffers,
|
||||
ReadHandler && handler = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>,
|
||||
typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type * = 0);
|
||||
</pre>
|
||||
<p>
|
||||
This function is used to asynchronously read a certain number of bytes
|
||||
of data from a stream. The function call always returns immediately. The
|
||||
asynchronous operation will continue until one of the following conditions
|
||||
is true:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
The supplied buffers are full. That is, the bytes transferred is equal
|
||||
to the sum of the buffer sizes.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
An error occurred.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
This operation is implemented in terms of zero or more calls to the stream's
|
||||
async_read_some function, and is known as a <span class="emphasis"><em>composed operation</em></span>.
|
||||
The program must ensure that the stream performs no other read operations
|
||||
(such as async_read, the stream's async_read_some function, or any other
|
||||
composed operations that perform reads) until this operation completes.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.reference.async_read.overload1.h0"></a>
|
||||
<span><a name="asio.reference.async_read.overload1.parameters"></a></span><a class="link" href="overload1.html#asio.reference.async_read.overload1.parameters">Parameters</a>
|
||||
</h6>
|
||||
<div class="variablelist">
|
||||
<p class="title"><b></b></p>
|
||||
<dl>
|
||||
<dt><span class="term">s</span></dt>
|
||||
<dd><p>
|
||||
The stream from which the data is to be read. The type must support
|
||||
the AsyncReadStream concept.
|
||||
</p></dd>
|
||||
<dt><span class="term">buffers</span></dt>
|
||||
<dd><p>
|
||||
One or more buffers into which the data will be read. The sum of
|
||||
the buffer sizes indicates the maximum number of bytes to read from
|
||||
the stream. Although the buffers object may be copied as necessary,
|
||||
ownership of the underlying memory blocks is retained by the caller,
|
||||
which must guarantee that they remain valid until the handler is
|
||||
called.
|
||||
</p></dd>
|
||||
<dt><span class="term">handler</span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
The handler to be called when the read operation completes. Copies
|
||||
will be made of the handler as required. The function signature of
|
||||
the handler must be:
|
||||
</p>
|
||||
<pre class="programlisting">void handler(
|
||||
const asio::error_code& error, // Result of operation.
|
||||
|
||||
std::size_t bytes_transferred // Number of bytes copied into the
|
||||
// buffers. If an error occurred,
|
||||
// this will be the number of
|
||||
// bytes successfully transferred
|
||||
// prior to the error.
|
||||
);
|
||||
</pre>
|
||||
<p>
|
||||
Regardless of whether the asynchronous operation completes immediately
|
||||
or not, the handler will not be invoked from within this function.
|
||||
On immediate completion, invocation of the handler will be performed
|
||||
in a manner equivalent to using <a class="link" href="../post.html" title="post"><code class="computeroutput">post</code></a>.
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<h6>
|
||||
<a name="asio.reference.async_read.overload1.h1"></a>
|
||||
<span><a name="asio.reference.async_read.overload1.example"></a></span><a class="link" href="overload1.html#asio.reference.async_read.overload1.example">Example</a>
|
||||
</h6>
|
||||
<p>
|
||||
To read into a single data buffer use the <a class="link" href="../buffer.html" title="buffer"><code class="computeroutput">buffer</code></a>
|
||||
function as follows:
|
||||
</p>
|
||||
<pre class="programlisting">asio::async_read(s, asio::buffer(data, size), handler);
|
||||
</pre>
|
||||
<p>
|
||||
See the <a class="link" href="../buffer.html" title="buffer"><code class="computeroutput">buffer</code></a>
|
||||
documentation for information on reading into multiple buffers in one go,
|
||||
and how to use it with arrays, boost::array or std::vector.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.reference.async_read.overload1.h2"></a>
|
||||
<span><a name="asio.reference.async_read.overload1.remarks"></a></span><a class="link" href="overload1.html#asio.reference.async_read.overload1.remarks">Remarks</a>
|
||||
</h6>
|
||||
<p>
|
||||
This overload is equivalent to calling:
|
||||
</p>
|
||||
<pre class="programlisting">asio::async_read(
|
||||
s, buffers,
|
||||
asio::transfer_all(),
|
||||
handler);
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../async_read.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_read.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="overload2.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,154 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>async_read (2 of 8 overloads)</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../async_read.html" title="async_read">
|
||||
<link rel="prev" href="overload1.html" title="async_read (1 of 8 overloads)">
|
||||
<link rel="next" href="overload3.html" title="async_read (3 of 8 overloads)">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload1.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_read.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="overload3.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.reference.async_read.overload2"></a><a class="link" href="overload2.html" title="async_read (2 of 8 overloads)">async_read (2
|
||||
of 8 overloads)</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Start an asynchronous operation to read a certain amount of data from a
|
||||
stream.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename <a class="link" href="../AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">AsyncReadStream</a>,
|
||||
typename <a class="link" href="../MutableBufferSequence.html" title="Mutable buffer sequence requirements">MutableBufferSequence</a>,
|
||||
typename <a class="link" href="../CompletionCondition.html" title="Completion condition requirements">CompletionCondition</a>,
|
||||
typename <a class="link" href="../ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> async_read(
|
||||
AsyncReadStream & s,
|
||||
const MutableBufferSequence & buffers,
|
||||
CompletionCondition completion_condition,
|
||||
ReadHandler && handler = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>,
|
||||
typename enable_if< is_mutable_buffer_sequence< MutableBufferSequence >::value >::type * = 0);
|
||||
</pre>
|
||||
<p>
|
||||
This function is used to asynchronously read a certain number of bytes
|
||||
of data from a stream. The function call always returns immediately. The
|
||||
asynchronous operation will continue until one of the following conditions
|
||||
is true:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
The supplied buffers are full. That is, the bytes transferred is equal
|
||||
to the sum of the buffer sizes.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
The completion_condition function object returns 0.
|
||||
</li>
|
||||
</ul></div>
|
||||
<h6>
|
||||
<a name="asio.reference.async_read.overload2.h0"></a>
|
||||
<span><a name="asio.reference.async_read.overload2.parameters"></a></span><a class="link" href="overload2.html#asio.reference.async_read.overload2.parameters">Parameters</a>
|
||||
</h6>
|
||||
<div class="variablelist">
|
||||
<p class="title"><b></b></p>
|
||||
<dl>
|
||||
<dt><span class="term">s</span></dt>
|
||||
<dd><p>
|
||||
The stream from which the data is to be read. The type must support
|
||||
the AsyncReadStream concept.
|
||||
</p></dd>
|
||||
<dt><span class="term">buffers</span></dt>
|
||||
<dd><p>
|
||||
One or more buffers into which the data will be read. The sum of
|
||||
the buffer sizes indicates the maximum number of bytes to read from
|
||||
the stream. Although the buffers object may be copied as necessary,
|
||||
ownership of the underlying memory blocks is retained by the caller,
|
||||
which must guarantee that they remain valid until the handler is
|
||||
called.
|
||||
</p></dd>
|
||||
<dt><span class="term">completion_condition</span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
The function object to be called to determine whether the read operation
|
||||
is complete. The signature of the function object must be:
|
||||
</p>
|
||||
<pre class="programlisting">std::size_t completion_condition(
|
||||
// Result of latest async_read_some operation.
|
||||
const asio::error_code& error,
|
||||
|
||||
// Number of bytes transferred so far.
|
||||
std::size_t bytes_transferred
|
||||
);
|
||||
</pre>
|
||||
<p>
|
||||
A return value of 0 indicates that the read operation is complete.
|
||||
A non-zero return value indicates the maximum number of bytes to
|
||||
be read on the next call to the stream's async_read_some function.
|
||||
</p>
|
||||
</dd>
|
||||
<dt><span class="term">handler</span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
The handler to be called when the read operation completes. Copies
|
||||
will be made of the handler as required. The function signature of
|
||||
the handler must be:
|
||||
</p>
|
||||
<pre class="programlisting">void handler(
|
||||
const asio::error_code& error, // Result of operation.
|
||||
|
||||
std::size_t bytes_transferred // Number of bytes copied into the
|
||||
// buffers. If an error occurred,
|
||||
// this will be the number of
|
||||
// bytes successfully transferred
|
||||
// prior to the error.
|
||||
);
|
||||
</pre>
|
||||
<p>
|
||||
Regardless of whether the asynchronous operation completes immediately
|
||||
or not, the handler will not be invoked from within this function.
|
||||
On immediate completion, invocation of the handler will be performed
|
||||
in a manner equivalent to using <a class="link" href="../post.html" title="post"><code class="computeroutput">post</code></a>.
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<h6>
|
||||
<a name="asio.reference.async_read.overload2.h1"></a>
|
||||
<span><a name="asio.reference.async_read.overload2.example"></a></span><a class="link" href="overload2.html#asio.reference.async_read.overload2.example">Example</a>
|
||||
</h6>
|
||||
<p>
|
||||
To read into a single data buffer use the <a class="link" href="../buffer.html" title="buffer"><code class="computeroutput">buffer</code></a>
|
||||
function as follows:
|
||||
</p>
|
||||
<pre class="programlisting">asio::async_read(s,
|
||||
asio::buffer(data, size),
|
||||
asio::transfer_at_least(32),
|
||||
handler);
|
||||
</pre>
|
||||
<p>
|
||||
See the <a class="link" href="../buffer.html" title="buffer"><code class="computeroutput">buffer</code></a>
|
||||
documentation for information on reading into multiple buffers in one go,
|
||||
and how to use it with arrays, boost::array or std::vector.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload1.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_read.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="overload3.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,131 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>async_read (3 of 8 overloads)</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../async_read.html" title="async_read">
|
||||
<link rel="prev" href="overload2.html" title="async_read (2 of 8 overloads)">
|
||||
<link rel="next" href="overload4.html" title="async_read (4 of 8 overloads)">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload2.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_read.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="overload4.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.reference.async_read.overload3"></a><a class="link" href="overload3.html" title="async_read (3 of 8 overloads)">async_read (3
|
||||
of 8 overloads)</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Start an asynchronous operation to read a certain amount of data from a
|
||||
stream.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename <a class="link" href="../AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">AsyncReadStream</a>,
|
||||
typename <a class="link" href="../DynamicBuffer_v1.html" title="Dynamic buffer requirements (version 1)">DynamicBuffer_v1</a>,
|
||||
typename <a class="link" href="../ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> async_read(
|
||||
AsyncReadStream & s,
|
||||
DynamicBuffer_v1 && buffers,
|
||||
ReadHandler && handler = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>,
|
||||
typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
|
||||
</pre>
|
||||
<p>
|
||||
This function is used to asynchronously read a certain number of bytes
|
||||
of data from a stream. The function call always returns immediately. The
|
||||
asynchronous operation will continue until one of the following conditions
|
||||
is true:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
The specified dynamic buffer sequence is full (that is, it has reached
|
||||
maximum size).
|
||||
</li>
|
||||
<li class="listitem">
|
||||
An error occurred.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
This operation is implemented in terms of zero or more calls to the stream's
|
||||
async_read_some function, and is known as a <span class="emphasis"><em>composed operation</em></span>.
|
||||
The program must ensure that the stream performs no other read operations
|
||||
(such as async_read, the stream's async_read_some function, or any other
|
||||
composed operations that perform reads) until this operation completes.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.reference.async_read.overload3.h0"></a>
|
||||
<span><a name="asio.reference.async_read.overload3.parameters"></a></span><a class="link" href="overload3.html#asio.reference.async_read.overload3.parameters">Parameters</a>
|
||||
</h6>
|
||||
<div class="variablelist">
|
||||
<p class="title"><b></b></p>
|
||||
<dl>
|
||||
<dt><span class="term">s</span></dt>
|
||||
<dd><p>
|
||||
The stream from which the data is to be read. The type must support
|
||||
the AsyncReadStream concept.
|
||||
</p></dd>
|
||||
<dt><span class="term">buffers</span></dt>
|
||||
<dd><p>
|
||||
The dynamic buffer sequence into which the data will be read. Although
|
||||
the buffers object may be copied as necessary, ownership of the underlying
|
||||
memory blocks is retained by the caller, which must guarantee that
|
||||
they remain valid until the handler is called.
|
||||
</p></dd>
|
||||
<dt><span class="term">handler</span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
The handler to be called when the read operation completes. Copies
|
||||
will be made of the handler as required. The function signature of
|
||||
the handler must be:
|
||||
</p>
|
||||
<pre class="programlisting">void handler(
|
||||
const asio::error_code& error, // Result of operation.
|
||||
|
||||
std::size_t bytes_transferred // Number of bytes copied into the
|
||||
// buffers. If an error occurred,
|
||||
// this will be the number of
|
||||
// bytes successfully transferred
|
||||
// prior to the error.
|
||||
);
|
||||
</pre>
|
||||
<p>
|
||||
Regardless of whether the asynchronous operation completes immediately
|
||||
or not, the handler will not be invoked from within this function.
|
||||
On immediate completion, invocation of the handler will be performed
|
||||
in a manner equivalent to using <a class="link" href="../post.html" title="post"><code class="computeroutput">post</code></a>.
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<h6>
|
||||
<a name="asio.reference.async_read.overload3.h1"></a>
|
||||
<span><a name="asio.reference.async_read.overload3.remarks"></a></span><a class="link" href="overload3.html#asio.reference.async_read.overload3.remarks">Remarks</a>
|
||||
</h6>
|
||||
<p>
|
||||
This overload is equivalent to calling:
|
||||
</p>
|
||||
<pre class="programlisting">asio::async_read(
|
||||
s, buffers,
|
||||
asio::transfer_all(),
|
||||
handler);
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload2.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_read.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="overload4.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,141 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>async_read (4 of 8 overloads)</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../async_read.html" title="async_read">
|
||||
<link rel="prev" href="overload3.html" title="async_read (3 of 8 overloads)">
|
||||
<link rel="next" href="overload5.html" title="async_read (5 of 8 overloads)">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload3.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_read.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="overload5.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.reference.async_read.overload4"></a><a class="link" href="overload4.html" title="async_read (4 of 8 overloads)">async_read (4
|
||||
of 8 overloads)</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Start an asynchronous operation to read a certain amount of data from a
|
||||
stream.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename <a class="link" href="../AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">AsyncReadStream</a>,
|
||||
typename <a class="link" href="../DynamicBuffer_v1.html" title="Dynamic buffer requirements (version 1)">DynamicBuffer_v1</a>,
|
||||
typename <a class="link" href="../CompletionCondition.html" title="Completion condition requirements">CompletionCondition</a>,
|
||||
typename <a class="link" href="../ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> async_read(
|
||||
AsyncReadStream & s,
|
||||
DynamicBuffer_v1 && buffers,
|
||||
CompletionCondition completion_condition,
|
||||
ReadHandler && handler = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>,
|
||||
typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
|
||||
</pre>
|
||||
<p>
|
||||
This function is used to asynchronously read a certain number of bytes
|
||||
of data from a stream. The function call always returns immediately. The
|
||||
asynchronous operation will continue until one of the following conditions
|
||||
is true:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
The specified dynamic buffer sequence is full (that is, it has reached
|
||||
maximum size).
|
||||
</li>
|
||||
<li class="listitem">
|
||||
The completion_condition function object returns 0.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
This operation is implemented in terms of zero or more calls to the stream's
|
||||
async_read_some function, and is known as a <span class="emphasis"><em>composed operation</em></span>.
|
||||
The program must ensure that the stream performs no other read operations
|
||||
(such as async_read, the stream's async_read_some function, or any other
|
||||
composed operations that perform reads) until this operation completes.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.reference.async_read.overload4.h0"></a>
|
||||
<span><a name="asio.reference.async_read.overload4.parameters"></a></span><a class="link" href="overload4.html#asio.reference.async_read.overload4.parameters">Parameters</a>
|
||||
</h6>
|
||||
<div class="variablelist">
|
||||
<p class="title"><b></b></p>
|
||||
<dl>
|
||||
<dt><span class="term">s</span></dt>
|
||||
<dd><p>
|
||||
The stream from which the data is to be read. The type must support
|
||||
the AsyncReadStream concept.
|
||||
</p></dd>
|
||||
<dt><span class="term">buffers</span></dt>
|
||||
<dd><p>
|
||||
The dynamic buffer sequence into which the data will be read. Although
|
||||
the buffers object may be copied as necessary, ownership of the underlying
|
||||
memory blocks is retained by the caller, which must guarantee that
|
||||
they remain valid until the handler is called.
|
||||
</p></dd>
|
||||
<dt><span class="term">completion_condition</span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
The function object to be called to determine whether the read operation
|
||||
is complete. The signature of the function object must be:
|
||||
</p>
|
||||
<pre class="programlisting">std::size_t completion_condition(
|
||||
// Result of latest async_read_some operation.
|
||||
const asio::error_code& error,
|
||||
|
||||
// Number of bytes transferred so far.
|
||||
std::size_t bytes_transferred
|
||||
);
|
||||
</pre>
|
||||
<p>
|
||||
A return value of 0 indicates that the read operation is complete.
|
||||
A non-zero return value indicates the maximum number of bytes to
|
||||
be read on the next call to the stream's async_read_some function.
|
||||
</p>
|
||||
</dd>
|
||||
<dt><span class="term">handler</span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
The handler to be called when the read operation completes. Copies
|
||||
will be made of the handler as required. The function signature of
|
||||
the handler must be:
|
||||
</p>
|
||||
<pre class="programlisting">void handler(
|
||||
const asio::error_code& error, // Result of operation.
|
||||
|
||||
std::size_t bytes_transferred // Number of bytes copied into the
|
||||
// buffers. If an error occurred,
|
||||
// this will be the number of
|
||||
// bytes successfully transferred
|
||||
// prior to the error.
|
||||
);
|
||||
</pre>
|
||||
<p>
|
||||
Regardless of whether the asynchronous operation completes immediately
|
||||
or not, the handler will not be invoked from within this function.
|
||||
On immediate completion, invocation of the handler will be performed
|
||||
in a manner equivalent to using <a class="link" href="../post.html" title="post"><code class="computeroutput">post</code></a>.
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload3.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_read.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="overload5.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,129 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>async_read (5 of 8 overloads)</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../async_read.html" title="async_read">
|
||||
<link rel="prev" href="overload4.html" title="async_read (4 of 8 overloads)">
|
||||
<link rel="next" href="overload6.html" title="async_read (6 of 8 overloads)">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload4.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_read.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="overload6.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.reference.async_read.overload5"></a><a class="link" href="overload5.html" title="async_read (5 of 8 overloads)">async_read (5
|
||||
of 8 overloads)</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Start an asynchronous operation to read a certain amount of data from a
|
||||
stream.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename <a class="link" href="../AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">AsyncReadStream</a>,
|
||||
typename Allocator,
|
||||
typename <a class="link" href="../ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> async_read(
|
||||
AsyncReadStream & s,
|
||||
basic_streambuf< Allocator > & b,
|
||||
ReadHandler && handler = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>);
|
||||
</pre>
|
||||
<p>
|
||||
This function is used to asynchronously read a certain number of bytes
|
||||
of data from a stream. The function call always returns immediately. The
|
||||
asynchronous operation will continue until one of the following conditions
|
||||
is true:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
The supplied buffer is full (that is, it has reached maximum size).
|
||||
</li>
|
||||
<li class="listitem">
|
||||
An error occurred.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
This operation is implemented in terms of zero or more calls to the stream's
|
||||
async_read_some function, and is known as a <span class="emphasis"><em>composed operation</em></span>.
|
||||
The program must ensure that the stream performs no other read operations
|
||||
(such as async_read, the stream's async_read_some function, or any other
|
||||
composed operations that perform reads) until this operation completes.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.reference.async_read.overload5.h0"></a>
|
||||
<span><a name="asio.reference.async_read.overload5.parameters"></a></span><a class="link" href="overload5.html#asio.reference.async_read.overload5.parameters">Parameters</a>
|
||||
</h6>
|
||||
<div class="variablelist">
|
||||
<p class="title"><b></b></p>
|
||||
<dl>
|
||||
<dt><span class="term">s</span></dt>
|
||||
<dd><p>
|
||||
The stream from which the data is to be read. The type must support
|
||||
the AsyncReadStream concept.
|
||||
</p></dd>
|
||||
<dt><span class="term">b</span></dt>
|
||||
<dd><p>
|
||||
A <a class="link" href="../basic_streambuf.html" title="basic_streambuf"><code class="computeroutput">basic_streambuf</code></a>
|
||||
object into which the data will be read. Ownership of the streambuf
|
||||
is retained by the caller, which must guarantee that it remains valid
|
||||
until the handler is called.
|
||||
</p></dd>
|
||||
<dt><span class="term">handler</span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
The handler to be called when the read operation completes. Copies
|
||||
will be made of the handler as required. The function signature of
|
||||
the handler must be:
|
||||
</p>
|
||||
<pre class="programlisting">void handler(
|
||||
const asio::error_code& error, // Result of operation.
|
||||
|
||||
std::size_t bytes_transferred // Number of bytes copied into the
|
||||
// buffers. If an error occurred,
|
||||
// this will be the number of
|
||||
// bytes successfully transferred
|
||||
// prior to the error.
|
||||
);
|
||||
</pre>
|
||||
<p>
|
||||
Regardless of whether the asynchronous operation completes immediately
|
||||
or not, the handler will not be invoked from within this function.
|
||||
On immediate completion, invocation of the handler will be performed
|
||||
in a manner equivalent to using <a class="link" href="../post.html" title="post"><code class="computeroutput">post</code></a>.
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<h6>
|
||||
<a name="asio.reference.async_read.overload5.h1"></a>
|
||||
<span><a name="asio.reference.async_read.overload5.remarks"></a></span><a class="link" href="overload5.html#asio.reference.async_read.overload5.remarks">Remarks</a>
|
||||
</h6>
|
||||
<p>
|
||||
This overload is equivalent to calling:
|
||||
</p>
|
||||
<pre class="programlisting">asio::async_read(
|
||||
s, b,
|
||||
asio::transfer_all(),
|
||||
handler);
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload4.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_read.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="overload6.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,139 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>async_read (6 of 8 overloads)</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../async_read.html" title="async_read">
|
||||
<link rel="prev" href="overload5.html" title="async_read (5 of 8 overloads)">
|
||||
<link rel="next" href="overload7.html" title="async_read (7 of 8 overloads)">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload5.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_read.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="overload7.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.reference.async_read.overload6"></a><a class="link" href="overload6.html" title="async_read (6 of 8 overloads)">async_read (6
|
||||
of 8 overloads)</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Start an asynchronous operation to read a certain amount of data from a
|
||||
stream.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename <a class="link" href="../AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">AsyncReadStream</a>,
|
||||
typename Allocator,
|
||||
typename <a class="link" href="../CompletionCondition.html" title="Completion condition requirements">CompletionCondition</a>,
|
||||
typename <a class="link" href="../ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> async_read(
|
||||
AsyncReadStream & s,
|
||||
basic_streambuf< Allocator > & b,
|
||||
CompletionCondition completion_condition,
|
||||
ReadHandler && handler = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>);
|
||||
</pre>
|
||||
<p>
|
||||
This function is used to asynchronously read a certain number of bytes
|
||||
of data from a stream. The function call always returns immediately. The
|
||||
asynchronous operation will continue until one of the following conditions
|
||||
is true:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
The supplied buffer is full (that is, it has reached maximum size).
|
||||
</li>
|
||||
<li class="listitem">
|
||||
The completion_condition function object returns 0.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
This operation is implemented in terms of zero or more calls to the stream's
|
||||
async_read_some function, and is known as a <span class="emphasis"><em>composed operation</em></span>.
|
||||
The program must ensure that the stream performs no other read operations
|
||||
(such as async_read, the stream's async_read_some function, or any other
|
||||
composed operations that perform reads) until this operation completes.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.reference.async_read.overload6.h0"></a>
|
||||
<span><a name="asio.reference.async_read.overload6.parameters"></a></span><a class="link" href="overload6.html#asio.reference.async_read.overload6.parameters">Parameters</a>
|
||||
</h6>
|
||||
<div class="variablelist">
|
||||
<p class="title"><b></b></p>
|
||||
<dl>
|
||||
<dt><span class="term">s</span></dt>
|
||||
<dd><p>
|
||||
The stream from which the data is to be read. The type must support
|
||||
the AsyncReadStream concept.
|
||||
</p></dd>
|
||||
<dt><span class="term">b</span></dt>
|
||||
<dd><p>
|
||||
A <a class="link" href="../basic_streambuf.html" title="basic_streambuf"><code class="computeroutput">basic_streambuf</code></a>
|
||||
object into which the data will be read. Ownership of the streambuf
|
||||
is retained by the caller, which must guarantee that it remains valid
|
||||
until the handler is called.
|
||||
</p></dd>
|
||||
<dt><span class="term">completion_condition</span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
The function object to be called to determine whether the read operation
|
||||
is complete. The signature of the function object must be:
|
||||
</p>
|
||||
<pre class="programlisting">std::size_t completion_condition(
|
||||
// Result of latest async_read_some operation.
|
||||
const asio::error_code& error,
|
||||
|
||||
// Number of bytes transferred so far.
|
||||
std::size_t bytes_transferred
|
||||
);
|
||||
</pre>
|
||||
<p>
|
||||
A return value of 0 indicates that the read operation is complete.
|
||||
A non-zero return value indicates the maximum number of bytes to
|
||||
be read on the next call to the stream's async_read_some function.
|
||||
</p>
|
||||
</dd>
|
||||
<dt><span class="term">handler</span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
The handler to be called when the read operation completes. Copies
|
||||
will be made of the handler as required. The function signature of
|
||||
the handler must be:
|
||||
</p>
|
||||
<pre class="programlisting">void handler(
|
||||
const asio::error_code& error, // Result of operation.
|
||||
|
||||
std::size_t bytes_transferred // Number of bytes copied into the
|
||||
// buffers. If an error occurred,
|
||||
// this will be the number of
|
||||
// bytes successfully transferred
|
||||
// prior to the error.
|
||||
);
|
||||
</pre>
|
||||
<p>
|
||||
Regardless of whether the asynchronous operation completes immediately
|
||||
or not, the handler will not be invoked from within this function.
|
||||
On immediate completion, invocation of the handler will be performed
|
||||
in a manner equivalent to using <a class="link" href="../post.html" title="post"><code class="computeroutput">post</code></a>.
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload5.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_read.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="overload7.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,131 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>async_read (7 of 8 overloads)</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../async_read.html" title="async_read">
|
||||
<link rel="prev" href="overload6.html" title="async_read (6 of 8 overloads)">
|
||||
<link rel="next" href="overload8.html" title="async_read (8 of 8 overloads)">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload6.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_read.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="overload8.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.reference.async_read.overload7"></a><a class="link" href="overload7.html" title="async_read (7 of 8 overloads)">async_read (7
|
||||
of 8 overloads)</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Start an asynchronous operation to read a certain amount of data from a
|
||||
stream.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename <a class="link" href="../AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">AsyncReadStream</a>,
|
||||
typename <a class="link" href="../DynamicBuffer_v2.html" title="Dynamic buffer requirements (version 2)">DynamicBuffer_v2</a>,
|
||||
typename <a class="link" href="../ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> async_read(
|
||||
AsyncReadStream & s,
|
||||
DynamicBuffer_v2 buffers,
|
||||
ReadHandler && handler = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>,
|
||||
typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
|
||||
</pre>
|
||||
<p>
|
||||
This function is used to asynchronously read a certain number of bytes
|
||||
of data from a stream. The function call always returns immediately. The
|
||||
asynchronous operation will continue until one of the following conditions
|
||||
is true:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
The specified dynamic buffer sequence is full (that is, it has reached
|
||||
maximum size).
|
||||
</li>
|
||||
<li class="listitem">
|
||||
An error occurred.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
This operation is implemented in terms of zero or more calls to the stream's
|
||||
async_read_some function, and is known as a <span class="emphasis"><em>composed operation</em></span>.
|
||||
The program must ensure that the stream performs no other read operations
|
||||
(such as async_read, the stream's async_read_some function, or any other
|
||||
composed operations that perform reads) until this operation completes.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.reference.async_read.overload7.h0"></a>
|
||||
<span><a name="asio.reference.async_read.overload7.parameters"></a></span><a class="link" href="overload7.html#asio.reference.async_read.overload7.parameters">Parameters</a>
|
||||
</h6>
|
||||
<div class="variablelist">
|
||||
<p class="title"><b></b></p>
|
||||
<dl>
|
||||
<dt><span class="term">s</span></dt>
|
||||
<dd><p>
|
||||
The stream from which the data is to be read. The type must support
|
||||
the AsyncReadStream concept.
|
||||
</p></dd>
|
||||
<dt><span class="term">buffers</span></dt>
|
||||
<dd><p>
|
||||
The dynamic buffer sequence into which the data will be read. Although
|
||||
the buffers object may be copied as necessary, ownership of the underlying
|
||||
memory blocks is retained by the caller, which must guarantee that
|
||||
they remain valid until the handler is called.
|
||||
</p></dd>
|
||||
<dt><span class="term">handler</span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
The handler to be called when the read operation completes. Copies
|
||||
will be made of the handler as required. The function signature of
|
||||
the handler must be:
|
||||
</p>
|
||||
<pre class="programlisting">void handler(
|
||||
const asio::error_code& error, // Result of operation.
|
||||
|
||||
std::size_t bytes_transferred // Number of bytes copied into the
|
||||
// buffers. If an error occurred,
|
||||
// this will be the number of
|
||||
// bytes successfully transferred
|
||||
// prior to the error.
|
||||
);
|
||||
</pre>
|
||||
<p>
|
||||
Regardless of whether the asynchronous operation completes immediately
|
||||
or not, the handler will not be invoked from within this function.
|
||||
On immediate completion, invocation of the handler will be performed
|
||||
in a manner equivalent to using <a class="link" href="../post.html" title="post"><code class="computeroutput">post</code></a>.
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<h6>
|
||||
<a name="asio.reference.async_read.overload7.h1"></a>
|
||||
<span><a name="asio.reference.async_read.overload7.remarks"></a></span><a class="link" href="overload7.html#asio.reference.async_read.overload7.remarks">Remarks</a>
|
||||
</h6>
|
||||
<p>
|
||||
This overload is equivalent to calling:
|
||||
</p>
|
||||
<pre class="programlisting">asio::async_read(
|
||||
s, buffers,
|
||||
asio::transfer_all(),
|
||||
handler);
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload6.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_read.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="overload8.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,141 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>async_read (8 of 8 overloads)</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../async_read.html" title="async_read">
|
||||
<link rel="prev" href="overload7.html" title="async_read (7 of 8 overloads)">
|
||||
<link rel="next" href="../async_read_at.html" title="async_read_at">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload7.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_read.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="../async_read_at.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.reference.async_read.overload8"></a><a class="link" href="overload8.html" title="async_read (8 of 8 overloads)">async_read (8
|
||||
of 8 overloads)</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Start an asynchronous operation to read a certain amount of data from a
|
||||
stream.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename <a class="link" href="../AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">AsyncReadStream</a>,
|
||||
typename <a class="link" href="../DynamicBuffer_v2.html" title="Dynamic buffer requirements (version 2)">DynamicBuffer_v2</a>,
|
||||
typename <a class="link" href="../CompletionCondition.html" title="Completion condition requirements">CompletionCondition</a>,
|
||||
typename <a class="link" href="../ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> async_read(
|
||||
AsyncReadStream & s,
|
||||
DynamicBuffer_v2 buffers,
|
||||
CompletionCondition completion_condition,
|
||||
ReadHandler && handler = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>,
|
||||
typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
|
||||
</pre>
|
||||
<p>
|
||||
This function is used to asynchronously read a certain number of bytes
|
||||
of data from a stream. The function call always returns immediately. The
|
||||
asynchronous operation will continue until one of the following conditions
|
||||
is true:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
The specified dynamic buffer sequence is full (that is, it has reached
|
||||
maximum size).
|
||||
</li>
|
||||
<li class="listitem">
|
||||
The completion_condition function object returns 0.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
This operation is implemented in terms of zero or more calls to the stream's
|
||||
async_read_some function, and is known as a <span class="emphasis"><em>composed operation</em></span>.
|
||||
The program must ensure that the stream performs no other read operations
|
||||
(such as async_read, the stream's async_read_some function, or any other
|
||||
composed operations that perform reads) until this operation completes.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.reference.async_read.overload8.h0"></a>
|
||||
<span><a name="asio.reference.async_read.overload8.parameters"></a></span><a class="link" href="overload8.html#asio.reference.async_read.overload8.parameters">Parameters</a>
|
||||
</h6>
|
||||
<div class="variablelist">
|
||||
<p class="title"><b></b></p>
|
||||
<dl>
|
||||
<dt><span class="term">s</span></dt>
|
||||
<dd><p>
|
||||
The stream from which the data is to be read. The type must support
|
||||
the AsyncReadStream concept.
|
||||
</p></dd>
|
||||
<dt><span class="term">buffers</span></dt>
|
||||
<dd><p>
|
||||
The dynamic buffer sequence into which the data will be read. Although
|
||||
the buffers object may be copied as necessary, ownership of the underlying
|
||||
memory blocks is retained by the caller, which must guarantee that
|
||||
they remain valid until the handler is called.
|
||||
</p></dd>
|
||||
<dt><span class="term">completion_condition</span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
The function object to be called to determine whether the read operation
|
||||
is complete. The signature of the function object must be:
|
||||
</p>
|
||||
<pre class="programlisting">std::size_t completion_condition(
|
||||
// Result of latest async_read_some operation.
|
||||
const asio::error_code& error,
|
||||
|
||||
// Number of bytes transferred so far.
|
||||
std::size_t bytes_transferred
|
||||
);
|
||||
</pre>
|
||||
<p>
|
||||
A return value of 0 indicates that the read operation is complete.
|
||||
A non-zero return value indicates the maximum number of bytes to
|
||||
be read on the next call to the stream's async_read_some function.
|
||||
</p>
|
||||
</dd>
|
||||
<dt><span class="term">handler</span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
The handler to be called when the read operation completes. Copies
|
||||
will be made of the handler as required. The function signature of
|
||||
the handler must be:
|
||||
</p>
|
||||
<pre class="programlisting">void handler(
|
||||
const asio::error_code& error, // Result of operation.
|
||||
|
||||
std::size_t bytes_transferred // Number of bytes copied into the
|
||||
// buffers. If an error occurred,
|
||||
// this will be the number of
|
||||
// bytes successfully transferred
|
||||
// prior to the error.
|
||||
);
|
||||
</pre>
|
||||
<p>
|
||||
Regardless of whether the asynchronous operation completes immediately
|
||||
or not, the handler will not be invoked from within this function.
|
||||
On immediate completion, invocation of the handler will be performed
|
||||
in a manner equivalent to using <a class="link" href="../post.html" title="post"><code class="computeroutput">post</code></a>.
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload7.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_read.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="../async_read_at.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,105 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>async_read_at</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="async_read/overload8.html" title="async_read (8 of 8 overloads)">
|
||||
<link rel="next" href="async_read_at/overload1.html" title="async_read_at (1 of 4 overloads)">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="async_read/overload8.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="async_read_at/overload1.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.async_read_at"></a><a class="link" href="async_read_at.html" title="async_read_at">async_read_at</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
<a class="indexterm" name="asio.indexterm.async_read_at"></a>
|
||||
The <code class="computeroutput">async_read_at</code> function
|
||||
is a composed asynchronous operation that reads a certain amount of data
|
||||
at the specified offset.
|
||||
</p>
|
||||
<p>
|
||||
Start an asynchronous operation to read a certain amount of data at the specified
|
||||
offset.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename <a class="link" href="AsyncRandomAccessReadDevice.html" title="Buffer-oriented asynchronous random-access read device requirements">AsyncRandomAccessReadDevice</a>,
|
||||
typename <a class="link" href="MutableBufferSequence.html" title="Mutable buffer sequence requirements">MutableBufferSequence</a>,
|
||||
typename <a class="link" href="ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> <a class="link" href="async_read_at/overload1.html" title="async_read_at (1 of 4 overloads)">async_read_at</a>(
|
||||
AsyncRandomAccessReadDevice & d,
|
||||
uint64_t offset,
|
||||
const MutableBufferSequence & buffers,
|
||||
ReadHandler && handler = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>);
|
||||
<span class="emphasis"><em>» <a class="link" href="async_read_at/overload1.html" title="async_read_at (1 of 4 overloads)">more...</a></em></span>
|
||||
|
||||
template<
|
||||
typename <a class="link" href="AsyncRandomAccessReadDevice.html" title="Buffer-oriented asynchronous random-access read device requirements">AsyncRandomAccessReadDevice</a>,
|
||||
typename <a class="link" href="MutableBufferSequence.html" title="Mutable buffer sequence requirements">MutableBufferSequence</a>,
|
||||
typename <a class="link" href="CompletionCondition.html" title="Completion condition requirements">CompletionCondition</a>,
|
||||
typename <a class="link" href="ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> <a class="link" href="async_read_at/overload2.html" title="async_read_at (2 of 4 overloads)">async_read_at</a>(
|
||||
AsyncRandomAccessReadDevice & d,
|
||||
uint64_t offset,
|
||||
const MutableBufferSequence & buffers,
|
||||
CompletionCondition completion_condition,
|
||||
ReadHandler && handler = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>);
|
||||
<span class="emphasis"><em>» <a class="link" href="async_read_at/overload2.html" title="async_read_at (2 of 4 overloads)">more...</a></em></span>
|
||||
|
||||
template<
|
||||
typename <a class="link" href="AsyncRandomAccessReadDevice.html" title="Buffer-oriented asynchronous random-access read device requirements">AsyncRandomAccessReadDevice</a>,
|
||||
typename Allocator,
|
||||
typename <a class="link" href="ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> <a class="link" href="async_read_at/overload3.html" title="async_read_at (3 of 4 overloads)">async_read_at</a>(
|
||||
AsyncRandomAccessReadDevice & d,
|
||||
uint64_t offset,
|
||||
basic_streambuf< Allocator > & b,
|
||||
ReadHandler && handler = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>);
|
||||
<span class="emphasis"><em>» <a class="link" href="async_read_at/overload3.html" title="async_read_at (3 of 4 overloads)">more...</a></em></span>
|
||||
|
||||
template<
|
||||
typename <a class="link" href="AsyncRandomAccessReadDevice.html" title="Buffer-oriented asynchronous random-access read device requirements">AsyncRandomAccessReadDevice</a>,
|
||||
typename Allocator,
|
||||
typename <a class="link" href="CompletionCondition.html" title="Completion condition requirements">CompletionCondition</a>,
|
||||
typename <a class="link" href="ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> <a class="link" href="async_read_at/overload4.html" title="async_read_at (4 of 4 overloads)">async_read_at</a>(
|
||||
AsyncRandomAccessReadDevice & d,
|
||||
uint64_t offset,
|
||||
basic_streambuf< Allocator > & b,
|
||||
CompletionCondition completion_condition,
|
||||
ReadHandler && handler = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>);
|
||||
<span class="emphasis"><em>» <a class="link" href="async_read_at/overload4.html" title="async_read_at (4 of 4 overloads)">more...</a></em></span>
|
||||
</pre>
|
||||
<h5>
|
||||
<a name="asio.reference.async_read_at.h0"></a>
|
||||
<span><a name="asio.reference.async_read_at.requirements"></a></span><a class="link" href="async_read_at.html#asio.reference.async_read_at.requirements">Requirements</a>
|
||||
</h5>
|
||||
<p>
|
||||
<span class="emphasis"><em>Header: </em></span><code class="literal">asio/read_at.hpp</code>
|
||||
</p>
|
||||
<p>
|
||||
<span class="emphasis"><em>Convenience header: </em></span><code class="literal">asio.hpp</code>
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="async_read/overload8.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="async_read_at/overload1.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,149 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>async_read_at (1 of 4 overloads)</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../async_read_at.html" title="async_read_at">
|
||||
<link rel="prev" href="../async_read_at.html" title="async_read_at">
|
||||
<link rel="next" href="overload2.html" title="async_read_at (2 of 4 overloads)">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../async_read_at.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_read_at.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="overload2.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.reference.async_read_at.overload1"></a><a class="link" href="overload1.html" title="async_read_at (1 of 4 overloads)">async_read_at
|
||||
(1 of 4 overloads)</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Start an asynchronous operation to read a certain amount of data at the
|
||||
specified offset.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename <a class="link" href="../AsyncRandomAccessReadDevice.html" title="Buffer-oriented asynchronous random-access read device requirements">AsyncRandomAccessReadDevice</a>,
|
||||
typename <a class="link" href="../MutableBufferSequence.html" title="Mutable buffer sequence requirements">MutableBufferSequence</a>,
|
||||
typename <a class="link" href="../ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> async_read_at(
|
||||
AsyncRandomAccessReadDevice & d,
|
||||
uint64_t offset,
|
||||
const MutableBufferSequence & buffers,
|
||||
ReadHandler && handler = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>);
|
||||
</pre>
|
||||
<p>
|
||||
This function is used to asynchronously read a certain number of bytes
|
||||
of data from a random access device at the specified offset. The function
|
||||
call always returns immediately. The asynchronous operation will continue
|
||||
until one of the following conditions is true:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
The supplied buffers are full. That is, the bytes transferred is equal
|
||||
to the sum of the buffer sizes.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
An error occurred.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
This operation is implemented in terms of zero or more calls to the device's
|
||||
async_read_some_at function.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.reference.async_read_at.overload1.h0"></a>
|
||||
<span><a name="asio.reference.async_read_at.overload1.parameters"></a></span><a class="link" href="overload1.html#asio.reference.async_read_at.overload1.parameters">Parameters</a>
|
||||
</h6>
|
||||
<div class="variablelist">
|
||||
<p class="title"><b></b></p>
|
||||
<dl>
|
||||
<dt><span class="term">d</span></dt>
|
||||
<dd><p>
|
||||
The device from which the data is to be read. The type must support
|
||||
the AsyncRandomAccessReadDevice concept.
|
||||
</p></dd>
|
||||
<dt><span class="term">offset</span></dt>
|
||||
<dd><p>
|
||||
The offset at which the data will be read.
|
||||
</p></dd>
|
||||
<dt><span class="term">buffers</span></dt>
|
||||
<dd><p>
|
||||
One or more buffers into which the data will be read. The sum of
|
||||
the buffer sizes indicates the maximum number of bytes to read from
|
||||
the device. Although the buffers object may be copied as necessary,
|
||||
ownership of the underlying memory blocks is retained by the caller,
|
||||
which must guarantee that they remain valid until the handler is
|
||||
called.
|
||||
</p></dd>
|
||||
<dt><span class="term">handler</span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
The handler to be called when the read operation completes. Copies
|
||||
will be made of the handler as required. The function signature of
|
||||
the handler must be:
|
||||
</p>
|
||||
<pre class="programlisting">void handler(
|
||||
// Result of operation.
|
||||
const asio::error_code& error,
|
||||
|
||||
// Number of bytes copied into the buffers. If an error
|
||||
// occurred, this will be the number of bytes successfully
|
||||
// transferred prior to the error.
|
||||
std::size_t bytes_transferred
|
||||
);
|
||||
</pre>
|
||||
<p>
|
||||
Regardless of whether the asynchronous operation completes immediately
|
||||
or not, the handler will not be invoked from within this function.
|
||||
On immediate completion, invocation of the handler will be performed
|
||||
in a manner equivalent to using <a class="link" href="../post.html" title="post"><code class="computeroutput">post</code></a>.
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<h6>
|
||||
<a name="asio.reference.async_read_at.overload1.h1"></a>
|
||||
<span><a name="asio.reference.async_read_at.overload1.example"></a></span><a class="link" href="overload1.html#asio.reference.async_read_at.overload1.example">Example</a>
|
||||
</h6>
|
||||
<p>
|
||||
To read into a single data buffer use the <a class="link" href="../buffer.html" title="buffer"><code class="computeroutput">buffer</code></a>
|
||||
function as follows:
|
||||
</p>
|
||||
<pre class="programlisting">asio::async_read_at(d, 42, asio::buffer(data, size), handler);
|
||||
</pre>
|
||||
<p>
|
||||
See the <a class="link" href="../buffer.html" title="buffer"><code class="computeroutput">buffer</code></a>
|
||||
documentation for information on reading into multiple buffers in one go,
|
||||
and how to use it with arrays, boost::array or std::vector.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.reference.async_read_at.overload1.h2"></a>
|
||||
<span><a name="asio.reference.async_read_at.overload1.remarks"></a></span><a class="link" href="overload1.html#asio.reference.async_read_at.overload1.remarks">Remarks</a>
|
||||
</h6>
|
||||
<p>
|
||||
This overload is equivalent to calling:
|
||||
</p>
|
||||
<pre class="programlisting">asio::async_read_at(
|
||||
d, 42, buffers,
|
||||
asio::transfer_all(),
|
||||
handler);
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../async_read_at.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_read_at.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="overload2.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,158 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>async_read_at (2 of 4 overloads)</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../async_read_at.html" title="async_read_at">
|
||||
<link rel="prev" href="overload1.html" title="async_read_at (1 of 4 overloads)">
|
||||
<link rel="next" href="overload3.html" title="async_read_at (3 of 4 overloads)">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload1.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_read_at.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="overload3.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.reference.async_read_at.overload2"></a><a class="link" href="overload2.html" title="async_read_at (2 of 4 overloads)">async_read_at
|
||||
(2 of 4 overloads)</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Start an asynchronous operation to read a certain amount of data at the
|
||||
specified offset.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename <a class="link" href="../AsyncRandomAccessReadDevice.html" title="Buffer-oriented asynchronous random-access read device requirements">AsyncRandomAccessReadDevice</a>,
|
||||
typename <a class="link" href="../MutableBufferSequence.html" title="Mutable buffer sequence requirements">MutableBufferSequence</a>,
|
||||
typename <a class="link" href="../CompletionCondition.html" title="Completion condition requirements">CompletionCondition</a>,
|
||||
typename <a class="link" href="../ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> async_read_at(
|
||||
AsyncRandomAccessReadDevice & d,
|
||||
uint64_t offset,
|
||||
const MutableBufferSequence & buffers,
|
||||
CompletionCondition completion_condition,
|
||||
ReadHandler && handler = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>);
|
||||
</pre>
|
||||
<p>
|
||||
This function is used to asynchronously read a certain number of bytes
|
||||
of data from a random access device at the specified offset. The function
|
||||
call always returns immediately. The asynchronous operation will continue
|
||||
until one of the following conditions is true:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
The supplied buffers are full. That is, the bytes transferred is equal
|
||||
to the sum of the buffer sizes.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
The completion_condition function object returns 0.
|
||||
</li>
|
||||
</ul></div>
|
||||
<h6>
|
||||
<a name="asio.reference.async_read_at.overload2.h0"></a>
|
||||
<span><a name="asio.reference.async_read_at.overload2.parameters"></a></span><a class="link" href="overload2.html#asio.reference.async_read_at.overload2.parameters">Parameters</a>
|
||||
</h6>
|
||||
<div class="variablelist">
|
||||
<p class="title"><b></b></p>
|
||||
<dl>
|
||||
<dt><span class="term">d</span></dt>
|
||||
<dd><p>
|
||||
The device from which the data is to be read. The type must support
|
||||
the AsyncRandomAccessReadDevice concept.
|
||||
</p></dd>
|
||||
<dt><span class="term">offset</span></dt>
|
||||
<dd><p>
|
||||
The offset at which the data will be read.
|
||||
</p></dd>
|
||||
<dt><span class="term">buffers</span></dt>
|
||||
<dd><p>
|
||||
One or more buffers into which the data will be read. The sum of
|
||||
the buffer sizes indicates the maximum number of bytes to read from
|
||||
the device. Although the buffers object may be copied as necessary,
|
||||
ownership of the underlying memory blocks is retained by the caller,
|
||||
which must guarantee that they remain valid until the handler is
|
||||
called.
|
||||
</p></dd>
|
||||
<dt><span class="term">completion_condition</span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
The function object to be called to determine whether the read operation
|
||||
is complete. The signature of the function object must be:
|
||||
</p>
|
||||
<pre class="programlisting">std::size_t completion_condition(
|
||||
// Result of latest async_read_some_at operation.
|
||||
const asio::error_code& error,
|
||||
|
||||
// Number of bytes transferred so far.
|
||||
std::size_t bytes_transferred
|
||||
);
|
||||
</pre>
|
||||
<p>
|
||||
A return value of 0 indicates that the read operation is complete.
|
||||
A non-zero return value indicates the maximum number of bytes to
|
||||
be read on the next call to the device's async_read_some_at function.
|
||||
</p>
|
||||
</dd>
|
||||
<dt><span class="term">handler</span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
The handler to be called when the read operation completes. Copies
|
||||
will be made of the handler as required. The function signature of
|
||||
the handler must be:
|
||||
</p>
|
||||
<pre class="programlisting">void handler(
|
||||
// Result of operation.
|
||||
const asio::error_code& error,
|
||||
|
||||
// Number of bytes copied into the buffers. If an error
|
||||
// occurred, this will be the number of bytes successfully
|
||||
// transferred prior to the error.
|
||||
std::size_t bytes_transferred
|
||||
);
|
||||
</pre>
|
||||
<p>
|
||||
Regardless of whether the asynchronous operation completes immediately
|
||||
or not, the handler will not be invoked from within this function.
|
||||
On immediate completion, invocation of the handler will be performed
|
||||
in a manner equivalent to using <a class="link" href="../post.html" title="post"><code class="computeroutput">post</code></a>.
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<h6>
|
||||
<a name="asio.reference.async_read_at.overload2.h1"></a>
|
||||
<span><a name="asio.reference.async_read_at.overload2.example"></a></span><a class="link" href="overload2.html#asio.reference.async_read_at.overload2.example">Example</a>
|
||||
</h6>
|
||||
<p>
|
||||
To read into a single data buffer use the <a class="link" href="../buffer.html" title="buffer"><code class="computeroutput">buffer</code></a>
|
||||
function as follows:
|
||||
</p>
|
||||
<pre class="programlisting">asio::async_read_at(d, 42,
|
||||
asio::buffer(data, size),
|
||||
asio::transfer_at_least(32),
|
||||
handler);
|
||||
</pre>
|
||||
<p>
|
||||
See the <a class="link" href="../buffer.html" title="buffer"><code class="computeroutput">buffer</code></a>
|
||||
documentation for information on reading into multiple buffers in one go,
|
||||
and how to use it with arrays, boost::array or std::vector.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload1.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_read_at.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="overload3.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,126 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>async_read_at (3 of 4 overloads)</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../async_read_at.html" title="async_read_at">
|
||||
<link rel="prev" href="overload2.html" title="async_read_at (2 of 4 overloads)">
|
||||
<link rel="next" href="overload4.html" title="async_read_at (4 of 4 overloads)">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload2.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_read_at.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="overload4.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.reference.async_read_at.overload3"></a><a class="link" href="overload3.html" title="async_read_at (3 of 4 overloads)">async_read_at
|
||||
(3 of 4 overloads)</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Start an asynchronous operation to read a certain amount of data at the
|
||||
specified offset.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename <a class="link" href="../AsyncRandomAccessReadDevice.html" title="Buffer-oriented asynchronous random-access read device requirements">AsyncRandomAccessReadDevice</a>,
|
||||
typename Allocator,
|
||||
typename <a class="link" href="../ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> async_read_at(
|
||||
AsyncRandomAccessReadDevice & d,
|
||||
uint64_t offset,
|
||||
basic_streambuf< Allocator > & b,
|
||||
ReadHandler && handler = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>);
|
||||
</pre>
|
||||
<p>
|
||||
This function is used to asynchronously read a certain number of bytes
|
||||
of data from a random access device at the specified offset. The function
|
||||
call always returns immediately. The asynchronous operation will continue
|
||||
until one of the following conditions is true:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
|
||||
An error occurred.
|
||||
</li></ul></div>
|
||||
<p>
|
||||
This operation is implemented in terms of zero or more calls to the device's
|
||||
async_read_some_at function.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.reference.async_read_at.overload3.h0"></a>
|
||||
<span><a name="asio.reference.async_read_at.overload3.parameters"></a></span><a class="link" href="overload3.html#asio.reference.async_read_at.overload3.parameters">Parameters</a>
|
||||
</h6>
|
||||
<div class="variablelist">
|
||||
<p class="title"><b></b></p>
|
||||
<dl>
|
||||
<dt><span class="term">d</span></dt>
|
||||
<dd><p>
|
||||
The device from which the data is to be read. The type must support
|
||||
the AsyncRandomAccessReadDevice concept.
|
||||
</p></dd>
|
||||
<dt><span class="term">offset</span></dt>
|
||||
<dd><p>
|
||||
The offset at which the data will be read.
|
||||
</p></dd>
|
||||
<dt><span class="term">b</span></dt>
|
||||
<dd><p>
|
||||
A <a class="link" href="../basic_streambuf.html" title="basic_streambuf"><code class="computeroutput">basic_streambuf</code></a>
|
||||
object into which the data will be read. Ownership of the streambuf
|
||||
is retained by the caller, which must guarantee that it remains valid
|
||||
until the handler is called.
|
||||
</p></dd>
|
||||
<dt><span class="term">handler</span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
The handler to be called when the read operation completes. Copies
|
||||
will be made of the handler as required. The function signature of
|
||||
the handler must be:
|
||||
</p>
|
||||
<pre class="programlisting">void handler(
|
||||
// Result of operation.
|
||||
const asio::error_code& error,
|
||||
|
||||
// Number of bytes copied into the buffers. If an error
|
||||
// occurred, this will be the number of bytes successfully
|
||||
// transferred prior to the error.
|
||||
std::size_t bytes_transferred
|
||||
);
|
||||
</pre>
|
||||
<p>
|
||||
Regardless of whether the asynchronous operation completes immediately
|
||||
or not, the handler will not be invoked from within this function.
|
||||
On immediate completion, invocation of the handler will be performed
|
||||
in a manner equivalent to using <a class="link" href="../post.html" title="post"><code class="computeroutput">post</code></a>.
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<h6>
|
||||
<a name="asio.reference.async_read_at.overload3.h1"></a>
|
||||
<span><a name="asio.reference.async_read_at.overload3.remarks"></a></span><a class="link" href="overload3.html#asio.reference.async_read_at.overload3.remarks">Remarks</a>
|
||||
</h6>
|
||||
<p>
|
||||
This overload is equivalent to calling:
|
||||
</p>
|
||||
<pre class="programlisting">asio::async_read_at(
|
||||
d, 42, b,
|
||||
asio::transfer_all(),
|
||||
handler);
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload2.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_read_at.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="overload4.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,136 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>async_read_at (4 of 4 overloads)</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../async_read_at.html" title="async_read_at">
|
||||
<link rel="prev" href="overload3.html" title="async_read_at (3 of 4 overloads)">
|
||||
<link rel="next" href="../async_read_until.html" title="async_read_until">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload3.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_read_at.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="../async_read_until.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.reference.async_read_at.overload4"></a><a class="link" href="overload4.html" title="async_read_at (4 of 4 overloads)">async_read_at
|
||||
(4 of 4 overloads)</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Start an asynchronous operation to read a certain amount of data at the
|
||||
specified offset.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename <a class="link" href="../AsyncRandomAccessReadDevice.html" title="Buffer-oriented asynchronous random-access read device requirements">AsyncRandomAccessReadDevice</a>,
|
||||
typename Allocator,
|
||||
typename <a class="link" href="../CompletionCondition.html" title="Completion condition requirements">CompletionCondition</a>,
|
||||
typename <a class="link" href="../ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> async_read_at(
|
||||
AsyncRandomAccessReadDevice & d,
|
||||
uint64_t offset,
|
||||
basic_streambuf< Allocator > & b,
|
||||
CompletionCondition completion_condition,
|
||||
ReadHandler && handler = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>);
|
||||
</pre>
|
||||
<p>
|
||||
This function is used to asynchronously read a certain number of bytes
|
||||
of data from a random access device at the specified offset. The function
|
||||
call always returns immediately. The asynchronous operation will continue
|
||||
until one of the following conditions is true:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
|
||||
The completion_condition function object returns 0.
|
||||
</li></ul></div>
|
||||
<p>
|
||||
This operation is implemented in terms of zero or more calls to the device's
|
||||
async_read_some_at function.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.reference.async_read_at.overload4.h0"></a>
|
||||
<span><a name="asio.reference.async_read_at.overload4.parameters"></a></span><a class="link" href="overload4.html#asio.reference.async_read_at.overload4.parameters">Parameters</a>
|
||||
</h6>
|
||||
<div class="variablelist">
|
||||
<p class="title"><b></b></p>
|
||||
<dl>
|
||||
<dt><span class="term">d</span></dt>
|
||||
<dd><p>
|
||||
The device from which the data is to be read. The type must support
|
||||
the AsyncRandomAccessReadDevice concept.
|
||||
</p></dd>
|
||||
<dt><span class="term">offset</span></dt>
|
||||
<dd><p>
|
||||
The offset at which the data will be read.
|
||||
</p></dd>
|
||||
<dt><span class="term">b</span></dt>
|
||||
<dd><p>
|
||||
A <a class="link" href="../basic_streambuf.html" title="basic_streambuf"><code class="computeroutput">basic_streambuf</code></a>
|
||||
object into which the data will be read. Ownership of the streambuf
|
||||
is retained by the caller, which must guarantee that it remains valid
|
||||
until the handler is called.
|
||||
</p></dd>
|
||||
<dt><span class="term">completion_condition</span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
The function object to be called to determine whether the read operation
|
||||
is complete. The signature of the function object must be:
|
||||
</p>
|
||||
<pre class="programlisting">std::size_t completion_condition(
|
||||
// Result of latest async_read_some_at operation.
|
||||
const asio::error_code& error,
|
||||
|
||||
// Number of bytes transferred so far.
|
||||
std::size_t bytes_transferred
|
||||
);
|
||||
</pre>
|
||||
<p>
|
||||
A return value of 0 indicates that the read operation is complete.
|
||||
A non-zero return value indicates the maximum number of bytes to
|
||||
be read on the next call to the device's async_read_some_at function.
|
||||
</p>
|
||||
</dd>
|
||||
<dt><span class="term">handler</span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
The handler to be called when the read operation completes. Copies
|
||||
will be made of the handler as required. The function signature of
|
||||
the handler must be:
|
||||
</p>
|
||||
<pre class="programlisting">void handler(
|
||||
// Result of operation.
|
||||
const asio::error_code& error,
|
||||
|
||||
// Number of bytes copied into the buffers. If an error
|
||||
// occurred, this will be the number of bytes successfully
|
||||
// transferred prior to the error.
|
||||
std::size_t bytes_transferred
|
||||
);
|
||||
</pre>
|
||||
<p>
|
||||
Regardless of whether the asynchronous operation completes immediately
|
||||
or not, the handler will not be invoked from within this function.
|
||||
On immediate completion, invocation of the handler will be performed
|
||||
in a manner equivalent to using <a class="link" href="../post.html" title="post"><code class="computeroutput">post</code></a>.
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload3.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_read_at.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="../async_read_until.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,234 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>async_read_until</title>
|
||||
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../index.html" title="Asio">
|
||||
<link rel="up" href="../reference.html" title="Reference">
|
||||
<link rel="prev" href="async_read_at/overload4.html" title="async_read_at (4 of 4 overloads)">
|
||||
<link rel="next" href="async_read_until/overload1.html" title="async_read_until (1 of 12 overloads)">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="async_read_at/overload4.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="async_read_until/overload1.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="asio.reference.async_read_until"></a><a class="link" href="async_read_until.html" title="async_read_until">async_read_until</a>
|
||||
</h3></div></div></div>
|
||||
<p>
|
||||
<a class="indexterm" name="asio.indexterm.async_read_until"></a>
|
||||
The <code class="computeroutput">async_read_until</code>
|
||||
function is a composed asynchronous operation that reads data into a dynamic
|
||||
buffer sequence, or into a streambuf, until it contains a delimiter, matches
|
||||
a regular expression, or a function object indicates a match.
|
||||
</p>
|
||||
<p>
|
||||
Start an asynchronous operation to read data into a dynamic buffer sequence
|
||||
until it contains a specified delimiter.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename <a class="link" href="AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">AsyncReadStream</a>,
|
||||
typename <a class="link" href="DynamicBuffer_v1.html" title="Dynamic buffer requirements (version 1)">DynamicBuffer_v1</a>,
|
||||
typename <a class="link" href="ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> <a class="link" href="async_read_until/overload1.html" title="async_read_until (1 of 12 overloads)">async_read_until</a>(
|
||||
AsyncReadStream & s,
|
||||
DynamicBuffer_v1 && buffers,
|
||||
char delim,
|
||||
ReadHandler && handler = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>,
|
||||
typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
|
||||
<span class="emphasis"><em>» <a class="link" href="async_read_until/overload1.html" title="async_read_until (1 of 12 overloads)">more...</a></em></span>
|
||||
|
||||
template<
|
||||
typename <a class="link" href="AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">AsyncReadStream</a>,
|
||||
typename <a class="link" href="DynamicBuffer_v1.html" title="Dynamic buffer requirements (version 1)">DynamicBuffer_v1</a>,
|
||||
typename <a class="link" href="ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> <a class="link" href="async_read_until/overload2.html" title="async_read_until (2 of 12 overloads)">async_read_until</a>(
|
||||
AsyncReadStream & s,
|
||||
DynamicBuffer_v1 && buffers,
|
||||
string_view delim,
|
||||
ReadHandler && handler = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>,
|
||||
typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
|
||||
<span class="emphasis"><em>» <a class="link" href="async_read_until/overload2.html" title="async_read_until (2 of 12 overloads)">more...</a></em></span>
|
||||
</pre>
|
||||
<p>
|
||||
Start an asynchronous operation to read data into a dynamic buffer sequence
|
||||
until some part of its data matches a regular expression.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename <a class="link" href="AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">AsyncReadStream</a>,
|
||||
typename <a class="link" href="DynamicBuffer_v1.html" title="Dynamic buffer requirements (version 1)">DynamicBuffer_v1</a>,
|
||||
typename <a class="link" href="ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> <a class="link" href="async_read_until/overload3.html" title="async_read_until (3 of 12 overloads)">async_read_until</a>(
|
||||
AsyncReadStream & s,
|
||||
DynamicBuffer_v1 && buffers,
|
||||
const boost::regex & expr,
|
||||
ReadHandler && handler = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>,
|
||||
typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
|
||||
<span class="emphasis"><em>» <a class="link" href="async_read_until/overload3.html" title="async_read_until (3 of 12 overloads)">more...</a></em></span>
|
||||
</pre>
|
||||
<p>
|
||||
Start an asynchronous operation to read data into a dynamic buffer sequence
|
||||
until a function object indicates a match.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename <a class="link" href="AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">AsyncReadStream</a>,
|
||||
typename <a class="link" href="DynamicBuffer_v1.html" title="Dynamic buffer requirements (version 1)">DynamicBuffer_v1</a>,
|
||||
typename MatchCondition,
|
||||
typename <a class="link" href="ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> <a class="link" href="async_read_until/overload4.html" title="async_read_until (4 of 12 overloads)">async_read_until</a>(
|
||||
AsyncReadStream & s,
|
||||
DynamicBuffer_v1 && buffers,
|
||||
MatchCondition match_condition,
|
||||
ReadHandler && handler = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>,
|
||||
typename enable_if< is_match_condition< MatchCondition >::value &&is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
|
||||
<span class="emphasis"><em>» <a class="link" href="async_read_until/overload4.html" title="async_read_until (4 of 12 overloads)">more...</a></em></span>
|
||||
</pre>
|
||||
<p>
|
||||
Start an asynchronous operation to read data into a streambuf until it contains
|
||||
a specified delimiter.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename <a class="link" href="AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">AsyncReadStream</a>,
|
||||
typename Allocator,
|
||||
typename <a class="link" href="ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> <a class="link" href="async_read_until/overload5.html" title="async_read_until (5 of 12 overloads)">async_read_until</a>(
|
||||
AsyncReadStream & s,
|
||||
asio::basic_streambuf< Allocator > & b,
|
||||
char delim,
|
||||
ReadHandler && handler = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>);
|
||||
<span class="emphasis"><em>» <a class="link" href="async_read_until/overload5.html" title="async_read_until (5 of 12 overloads)">more...</a></em></span>
|
||||
|
||||
template<
|
||||
typename <a class="link" href="AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">AsyncReadStream</a>,
|
||||
typename Allocator,
|
||||
typename <a class="link" href="ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> <a class="link" href="async_read_until/overload6.html" title="async_read_until (6 of 12 overloads)">async_read_until</a>(
|
||||
AsyncReadStream & s,
|
||||
asio::basic_streambuf< Allocator > & b,
|
||||
string_view delim,
|
||||
ReadHandler && handler = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>);
|
||||
<span class="emphasis"><em>» <a class="link" href="async_read_until/overload6.html" title="async_read_until (6 of 12 overloads)">more...</a></em></span>
|
||||
</pre>
|
||||
<p>
|
||||
Start an asynchronous operation to read data into a streambuf until some
|
||||
part of its data matches a regular expression.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename <a class="link" href="AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">AsyncReadStream</a>,
|
||||
typename Allocator,
|
||||
typename <a class="link" href="ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> <a class="link" href="async_read_until/overload7.html" title="async_read_until (7 of 12 overloads)">async_read_until</a>(
|
||||
AsyncReadStream & s,
|
||||
asio::basic_streambuf< Allocator > & b,
|
||||
const boost::regex & expr,
|
||||
ReadHandler && handler = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>);
|
||||
<span class="emphasis"><em>» <a class="link" href="async_read_until/overload7.html" title="async_read_until (7 of 12 overloads)">more...</a></em></span>
|
||||
</pre>
|
||||
<p>
|
||||
Start an asynchronous operation to read data into a streambuf until a function
|
||||
object indicates a match.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename <a class="link" href="AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">AsyncReadStream</a>,
|
||||
typename Allocator,
|
||||
typename MatchCondition,
|
||||
typename <a class="link" href="ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> <a class="link" href="async_read_until/overload8.html" title="async_read_until (8 of 12 overloads)">async_read_until</a>(
|
||||
AsyncReadStream & s,
|
||||
asio::basic_streambuf< Allocator > & b,
|
||||
MatchCondition match_condition,
|
||||
ReadHandler && handler = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>,
|
||||
typename enable_if< is_match_condition< MatchCondition >::value >::type * = 0);
|
||||
<span class="emphasis"><em>» <a class="link" href="async_read_until/overload8.html" title="async_read_until (8 of 12 overloads)">more...</a></em></span>
|
||||
</pre>
|
||||
<p>
|
||||
Start an asynchronous operation to read data into a dynamic buffer sequence
|
||||
until it contains a specified delimiter.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename <a class="link" href="AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">AsyncReadStream</a>,
|
||||
typename <a class="link" href="DynamicBuffer_v2.html" title="Dynamic buffer requirements (version 2)">DynamicBuffer_v2</a>,
|
||||
typename <a class="link" href="ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> <a class="link" href="async_read_until/overload9.html" title="async_read_until (9 of 12 overloads)">async_read_until</a>(
|
||||
AsyncReadStream & s,
|
||||
DynamicBuffer_v2 buffers,
|
||||
char delim,
|
||||
ReadHandler && handler = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>,
|
||||
typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
|
||||
<span class="emphasis"><em>» <a class="link" href="async_read_until/overload9.html" title="async_read_until (9 of 12 overloads)">more...</a></em></span>
|
||||
|
||||
template<
|
||||
typename <a class="link" href="AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">AsyncReadStream</a>,
|
||||
typename <a class="link" href="DynamicBuffer_v2.html" title="Dynamic buffer requirements (version 2)">DynamicBuffer_v2</a>,
|
||||
typename <a class="link" href="ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> <a class="link" href="async_read_until/overload10.html" title="async_read_until (10 of 12 overloads)">async_read_until</a>(
|
||||
AsyncReadStream & s,
|
||||
DynamicBuffer_v2 buffers,
|
||||
string_view delim,
|
||||
ReadHandler && handler = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>,
|
||||
typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
|
||||
<span class="emphasis"><em>» <a class="link" href="async_read_until/overload10.html" title="async_read_until (10 of 12 overloads)">more...</a></em></span>
|
||||
</pre>
|
||||
<p>
|
||||
Start an asynchronous operation to read data into a dynamic buffer sequence
|
||||
until some part of its data matches a regular expression.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename <a class="link" href="AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">AsyncReadStream</a>,
|
||||
typename <a class="link" href="DynamicBuffer_v2.html" title="Dynamic buffer requirements (version 2)">DynamicBuffer_v2</a>,
|
||||
typename <a class="link" href="ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> <a class="link" href="async_read_until/overload11.html" title="async_read_until (11 of 12 overloads)">async_read_until</a>(
|
||||
AsyncReadStream & s,
|
||||
DynamicBuffer_v2 buffers,
|
||||
const boost::regex & expr,
|
||||
ReadHandler && handler = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>,
|
||||
typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
|
||||
<span class="emphasis"><em>» <a class="link" href="async_read_until/overload11.html" title="async_read_until (11 of 12 overloads)">more...</a></em></span>
|
||||
</pre>
|
||||
<p>
|
||||
Start an asynchronous operation to read data into a dynamic buffer sequence
|
||||
until a function object indicates a match.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename <a class="link" href="AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">AsyncReadStream</a>,
|
||||
typename <a class="link" href="DynamicBuffer_v2.html" title="Dynamic buffer requirements (version 2)">DynamicBuffer_v2</a>,
|
||||
typename MatchCondition,
|
||||
typename <a class="link" href="ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> <a class="link" href="async_read_until/overload12.html" title="async_read_until (12 of 12 overloads)">async_read_until</a>(
|
||||
AsyncReadStream & s,
|
||||
DynamicBuffer_v2 buffers,
|
||||
MatchCondition match_condition,
|
||||
ReadHandler && handler = <a class="link" href="asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>,
|
||||
typename enable_if< is_match_condition< MatchCondition >::value &&is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
|
||||
<span class="emphasis"><em>» <a class="link" href="async_read_until/overload12.html" title="async_read_until (12 of 12 overloads)">more...</a></em></span>
|
||||
</pre>
|
||||
<h5>
|
||||
<a name="asio.reference.async_read_until.h0"></a>
|
||||
<span><a name="asio.reference.async_read_until.requirements"></a></span><a class="link" href="async_read_until.html#asio.reference.async_read_until.requirements">Requirements</a>
|
||||
</h5>
|
||||
<p>
|
||||
<span class="emphasis"><em>Header: </em></span><code class="literal">asio/read_until.hpp</code>
|
||||
</p>
|
||||
<p>
|
||||
<span class="emphasis"><em>Convenience header: </em></span><code class="literal">asio.hpp</code>
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="async_read_at/overload4.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="async_read_until/overload1.html"><img src="../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,181 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>async_read_until (1 of 12 overloads)</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../async_read_until.html" title="async_read_until">
|
||||
<link rel="prev" href="../async_read_until.html" title="async_read_until">
|
||||
<link rel="next" href="overload2.html" title="async_read_until (2 of 12 overloads)">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../async_read_until.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_read_until.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="overload2.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.reference.async_read_until.overload1"></a><a class="link" href="overload1.html" title="async_read_until (1 of 12 overloads)">async_read_until
|
||||
(1 of 12 overloads)</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Start an asynchronous operation to read data into a dynamic buffer sequence
|
||||
until it contains a specified delimiter.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename <a class="link" href="../AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">AsyncReadStream</a>,
|
||||
typename <a class="link" href="../DynamicBuffer_v1.html" title="Dynamic buffer requirements (version 1)">DynamicBuffer_v1</a>,
|
||||
typename <a class="link" href="../ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> async_read_until(
|
||||
AsyncReadStream & s,
|
||||
DynamicBuffer_v1 && buffers,
|
||||
char delim,
|
||||
ReadHandler && handler = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>,
|
||||
typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
|
||||
</pre>
|
||||
<p>
|
||||
This function is used to asynchronously read data into the specified dynamic
|
||||
buffer sequence until the dynamic buffer sequence's get area contains the
|
||||
specified delimiter. The function call always returns immediately. The
|
||||
asynchronous operation will continue until one of the following conditions
|
||||
is true:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
The get area of the dynamic buffer sequence contains the specified
|
||||
delimiter.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
An error occurred.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
This operation is implemented in terms of zero or more calls to the stream's
|
||||
async_read_some function, and is known as a <span class="emphasis"><em>composed operation</em></span>.
|
||||
If the dynamic buffer sequence's get area already contains the delimiter,
|
||||
this asynchronous operation completes immediately. The program must ensure
|
||||
that the stream performs no other read operations (such as async_read,
|
||||
async_read_until, the stream's async_read_some function, or any other composed
|
||||
operations that perform reads) until this operation completes.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.reference.async_read_until.overload1.h0"></a>
|
||||
<span><a name="asio.reference.async_read_until.overload1.parameters"></a></span><a class="link" href="overload1.html#asio.reference.async_read_until.overload1.parameters">Parameters</a>
|
||||
</h6>
|
||||
<div class="variablelist">
|
||||
<p class="title"><b></b></p>
|
||||
<dl>
|
||||
<dt><span class="term">s</span></dt>
|
||||
<dd><p>
|
||||
The stream from which the data is to be read. The type must support
|
||||
the AsyncReadStream concept.
|
||||
</p></dd>
|
||||
<dt><span class="term">buffers</span></dt>
|
||||
<dd><p>
|
||||
The dynamic buffer sequence into which the data will be read. Although
|
||||
the buffers object may be copied as necessary, ownership of the underlying
|
||||
memory blocks is retained by the caller, which must guarantee that
|
||||
they remain valid until the handler is called.
|
||||
</p></dd>
|
||||
<dt><span class="term">delim</span></dt>
|
||||
<dd><p>
|
||||
The delimiter character.
|
||||
</p></dd>
|
||||
<dt><span class="term">handler</span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
The handler to be called when the read operation completes. Copies
|
||||
will be made of the handler as required. The function signature of
|
||||
the handler must be:
|
||||
</p>
|
||||
<pre class="programlisting">void handler(
|
||||
// Result of operation.
|
||||
const asio::error_code& error,
|
||||
|
||||
// The number of bytes in the dynamic buffer sequence's
|
||||
// get area up to and including the delimiter.
|
||||
// 0 if an error occurred.
|
||||
std::size_t bytes_transferred
|
||||
);
|
||||
</pre>
|
||||
<p>
|
||||
Regardless of whether the asynchronous operation completes immediately
|
||||
or not, the handler will not be invoked from within this function.
|
||||
On immediate completion, invocation of the handler will be performed
|
||||
in a manner equivalent to using <a class="link" href="../post.html" title="post"><code class="computeroutput">post</code></a>.
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<h6>
|
||||
<a name="asio.reference.async_read_until.overload1.h1"></a>
|
||||
<span><a name="asio.reference.async_read_until.overload1.remarks"></a></span><a class="link" href="overload1.html#asio.reference.async_read_until.overload1.remarks">Remarks</a>
|
||||
</h6>
|
||||
<p>
|
||||
After a successful async_read_until operation, the dynamic buffer sequence
|
||||
may contain additional data beyond the delimiter. An application will typically
|
||||
leave that data in the dynamic buffer sequence for a subsequent async_read_until
|
||||
operation to examine.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.reference.async_read_until.overload1.h2"></a>
|
||||
<span><a name="asio.reference.async_read_until.overload1.example"></a></span><a class="link" href="overload1.html#asio.reference.async_read_until.overload1.example">Example</a>
|
||||
</h6>
|
||||
<p>
|
||||
To asynchronously read data into a <code class="computeroutput">std::string</code> until a newline
|
||||
is encountered:
|
||||
</p>
|
||||
<pre class="programlisting">std::string data;
|
||||
...
|
||||
void handler(const asio::error_code& e, std::size_t size)
|
||||
{
|
||||
if (!e)
|
||||
{
|
||||
std::string line = data.substr(0, n);
|
||||
data.erase(0, n);
|
||||
...
|
||||
}
|
||||
}
|
||||
...
|
||||
asio::async_read_until(s, data, '\n', handler);
|
||||
</pre>
|
||||
<p>
|
||||
After the <code class="computeroutput">async_read_until</code> operation completes successfully,
|
||||
the buffer <code class="computeroutput">data</code> contains the delimiter:
|
||||
</p>
|
||||
<pre class="programlisting">{ 'a', 'b', ..., 'c', '\n', 'd', 'e', ... }
|
||||
</pre>
|
||||
<p>
|
||||
The call to <code class="computeroutput">substr</code> then extracts the data up to and including
|
||||
the delimiter, so that the string <code class="computeroutput">line</code> contains:
|
||||
</p>
|
||||
<pre class="programlisting">{ 'a', 'b', ..., 'c', '\n' }
|
||||
</pre>
|
||||
<p>
|
||||
After the call to <code class="computeroutput">erase</code>, the remaining data is left in the
|
||||
buffer <code class="computeroutput">data</code> as follows:
|
||||
</p>
|
||||
<pre class="programlisting">{ 'd', 'e', ... }
|
||||
</pre>
|
||||
<p>
|
||||
This data may be the start of a new line, to be extracted by a subsequent
|
||||
<code class="computeroutput">async_read_until</code> operation.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../async_read_until.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_read_until.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="overload2.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,181 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>async_read_until (10 of 12 overloads)</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../async_read_until.html" title="async_read_until">
|
||||
<link rel="prev" href="overload9.html" title="async_read_until (9 of 12 overloads)">
|
||||
<link rel="next" href="overload11.html" title="async_read_until (11 of 12 overloads)">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload9.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_read_until.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="overload11.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.reference.async_read_until.overload10"></a><a class="link" href="overload10.html" title="async_read_until (10 of 12 overloads)">async_read_until
|
||||
(10 of 12 overloads)</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Start an asynchronous operation to read data into a dynamic buffer sequence
|
||||
until it contains a specified delimiter.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename <a class="link" href="../AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">AsyncReadStream</a>,
|
||||
typename <a class="link" href="../DynamicBuffer_v2.html" title="Dynamic buffer requirements (version 2)">DynamicBuffer_v2</a>,
|
||||
typename <a class="link" href="../ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> async_read_until(
|
||||
AsyncReadStream & s,
|
||||
DynamicBuffer_v2 buffers,
|
||||
string_view delim,
|
||||
ReadHandler && handler = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>,
|
||||
typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
|
||||
</pre>
|
||||
<p>
|
||||
This function is used to asynchronously read data into the specified dynamic
|
||||
buffer sequence until the dynamic buffer sequence's get area contains the
|
||||
specified delimiter. The function call always returns immediately. The
|
||||
asynchronous operation will continue until one of the following conditions
|
||||
is true:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
The get area of the dynamic buffer sequence contains the specified
|
||||
delimiter.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
An error occurred.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
This operation is implemented in terms of zero or more calls to the stream's
|
||||
async_read_some function, and is known as a <span class="emphasis"><em>composed operation</em></span>.
|
||||
If the dynamic buffer sequence's get area already contains the delimiter,
|
||||
this asynchronous operation completes immediately. The program must ensure
|
||||
that the stream performs no other read operations (such as async_read,
|
||||
async_read_until, the stream's async_read_some function, or any other composed
|
||||
operations that perform reads) until this operation completes.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.reference.async_read_until.overload10.h0"></a>
|
||||
<span><a name="asio.reference.async_read_until.overload10.parameters"></a></span><a class="link" href="overload10.html#asio.reference.async_read_until.overload10.parameters">Parameters</a>
|
||||
</h6>
|
||||
<div class="variablelist">
|
||||
<p class="title"><b></b></p>
|
||||
<dl>
|
||||
<dt><span class="term">s</span></dt>
|
||||
<dd><p>
|
||||
The stream from which the data is to be read. The type must support
|
||||
the AsyncReadStream concept.
|
||||
</p></dd>
|
||||
<dt><span class="term">buffers</span></dt>
|
||||
<dd><p>
|
||||
The dynamic buffer sequence into which the data will be read. Although
|
||||
the buffers object may be copied as necessary, ownership of the underlying
|
||||
memory blocks is retained by the caller, which must guarantee that
|
||||
they remain valid until the handler is called.
|
||||
</p></dd>
|
||||
<dt><span class="term">delim</span></dt>
|
||||
<dd><p>
|
||||
The delimiter string.
|
||||
</p></dd>
|
||||
<dt><span class="term">handler</span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
The handler to be called when the read operation completes. Copies
|
||||
will be made of the handler as required. The function signature of
|
||||
the handler must be:
|
||||
</p>
|
||||
<pre class="programlisting">void handler(
|
||||
// Result of operation.
|
||||
const asio::error_code& error,
|
||||
|
||||
// The number of bytes in the dynamic buffer sequence's
|
||||
// get area up to and including the delimiter.
|
||||
// 0 if an error occurred.
|
||||
std::size_t bytes_transferred
|
||||
);
|
||||
</pre>
|
||||
<p>
|
||||
Regardless of whether the asynchronous operation completes immediately
|
||||
or not, the handler will not be invoked from within this function.
|
||||
On immediate completion, invocation of the handler will be performed
|
||||
in a manner equivalent to using <a class="link" href="../post.html" title="post"><code class="computeroutput">post</code></a>.
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<h6>
|
||||
<a name="asio.reference.async_read_until.overload10.h1"></a>
|
||||
<span><a name="asio.reference.async_read_until.overload10.remarks"></a></span><a class="link" href="overload10.html#asio.reference.async_read_until.overload10.remarks">Remarks</a>
|
||||
</h6>
|
||||
<p>
|
||||
After a successful async_read_until operation, the dynamic buffer sequence
|
||||
may contain additional data beyond the delimiter. An application will typically
|
||||
leave that data in the dynamic buffer sequence for a subsequent async_read_until
|
||||
operation to examine.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.reference.async_read_until.overload10.h2"></a>
|
||||
<span><a name="asio.reference.async_read_until.overload10.example"></a></span><a class="link" href="overload10.html#asio.reference.async_read_until.overload10.example">Example</a>
|
||||
</h6>
|
||||
<p>
|
||||
To asynchronously read data into a <code class="computeroutput">std::string</code> until a CR-LF
|
||||
sequence is encountered:
|
||||
</p>
|
||||
<pre class="programlisting">std::string data;
|
||||
...
|
||||
void handler(const asio::error_code& e, std::size_t size)
|
||||
{
|
||||
if (!e)
|
||||
{
|
||||
std::string line = data.substr(0, n);
|
||||
data.erase(0, n);
|
||||
...
|
||||
}
|
||||
}
|
||||
...
|
||||
asio::async_read_until(s, data, "\r\n", handler);
|
||||
</pre>
|
||||
<p>
|
||||
After the <code class="computeroutput">async_read_until</code> operation completes successfully,
|
||||
the string <code class="computeroutput">data</code> contains the delimiter:
|
||||
</p>
|
||||
<pre class="programlisting">{ 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... }
|
||||
</pre>
|
||||
<p>
|
||||
The call to <code class="computeroutput">substr</code> then extracts the data up to and including
|
||||
the delimiter, so that the string <code class="computeroutput">line</code> contains:
|
||||
</p>
|
||||
<pre class="programlisting">{ 'a', 'b', ..., 'c', '\r', '\n' }
|
||||
</pre>
|
||||
<p>
|
||||
After the call to <code class="computeroutput">erase</code>, the remaining data is left in the
|
||||
string <code class="computeroutput">data</code> as follows:
|
||||
</p>
|
||||
<pre class="programlisting">{ 'd', 'e', ... }
|
||||
</pre>
|
||||
<p>
|
||||
This data may be the start of a new line, to be extracted by a subsequent
|
||||
<code class="computeroutput">async_read_until</code> operation.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload9.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_read_until.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="overload11.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,185 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>async_read_until (11 of 12 overloads)</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../async_read_until.html" title="async_read_until">
|
||||
<link rel="prev" href="overload10.html" title="async_read_until (10 of 12 overloads)">
|
||||
<link rel="next" href="overload12.html" title="async_read_until (12 of 12 overloads)">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload10.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_read_until.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="overload12.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.reference.async_read_until.overload11"></a><a class="link" href="overload11.html" title="async_read_until (11 of 12 overloads)">async_read_until
|
||||
(11 of 12 overloads)</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Start an asynchronous operation to read data into a dynamic buffer sequence
|
||||
until some part of its data matches a regular expression.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename <a class="link" href="../AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">AsyncReadStream</a>,
|
||||
typename <a class="link" href="../DynamicBuffer_v2.html" title="Dynamic buffer requirements (version 2)">DynamicBuffer_v2</a>,
|
||||
typename <a class="link" href="../ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> async_read_until(
|
||||
AsyncReadStream & s,
|
||||
DynamicBuffer_v2 buffers,
|
||||
const boost::regex & expr,
|
||||
ReadHandler && handler = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>,
|
||||
typename enable_if< is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
|
||||
</pre>
|
||||
<p>
|
||||
This function is used to asynchronously read data into the specified dynamic
|
||||
buffer sequence until the dynamic buffer sequence's get area contains some
|
||||
data that matches a regular expression. The function call always returns
|
||||
immediately. The asynchronous operation will continue until one of the
|
||||
following conditions is true:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
A substring of the dynamic buffer sequence's get area matches the regular
|
||||
expression.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
An error occurred.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
This operation is implemented in terms of zero or more calls to the stream's
|
||||
async_read_some function, and is known as a <span class="emphasis"><em>composed operation</em></span>.
|
||||
If the dynamic buffer sequence's get area already contains data that matches
|
||||
the regular expression, this asynchronous operation completes immediately.
|
||||
The program must ensure that the stream performs no other read operations
|
||||
(such as async_read, async_read_until, the stream's async_read_some function,
|
||||
or any other composed operations that perform reads) until this operation
|
||||
completes.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.reference.async_read_until.overload11.h0"></a>
|
||||
<span><a name="asio.reference.async_read_until.overload11.parameters"></a></span><a class="link" href="overload11.html#asio.reference.async_read_until.overload11.parameters">Parameters</a>
|
||||
</h6>
|
||||
<div class="variablelist">
|
||||
<p class="title"><b></b></p>
|
||||
<dl>
|
||||
<dt><span class="term">s</span></dt>
|
||||
<dd><p>
|
||||
The stream from which the data is to be read. The type must support
|
||||
the AsyncReadStream concept.
|
||||
</p></dd>
|
||||
<dt><span class="term">buffers</span></dt>
|
||||
<dd><p>
|
||||
The dynamic buffer sequence into which the data will be read. Although
|
||||
the buffers object may be copied as necessary, ownership of the underlying
|
||||
memory blocks is retained by the caller, which must guarantee that
|
||||
they remain valid until the handler is called.
|
||||
</p></dd>
|
||||
<dt><span class="term">expr</span></dt>
|
||||
<dd><p>
|
||||
The regular expression.
|
||||
</p></dd>
|
||||
<dt><span class="term">handler</span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
The handler to be called when the read operation completes. Copies
|
||||
will be made of the handler as required. The function signature of
|
||||
the handler must be:
|
||||
</p>
|
||||
<pre class="programlisting">void handler(
|
||||
// Result of operation.
|
||||
const asio::error_code& error,
|
||||
|
||||
// The number of bytes in the dynamic buffer
|
||||
// sequence's get area up to and including the
|
||||
// substring that matches the regular expression.
|
||||
// 0 if an error occurred.
|
||||
std::size_t bytes_transferred
|
||||
);
|
||||
</pre>
|
||||
<p>
|
||||
Regardless of whether the asynchronous operation completes immediately
|
||||
or not, the handler will not be invoked from within this function.
|
||||
On immediate completion, invocation of the handler will be performed
|
||||
in a manner equivalent to using <a class="link" href="../post.html" title="post"><code class="computeroutput">post</code></a>.
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<h6>
|
||||
<a name="asio.reference.async_read_until.overload11.h1"></a>
|
||||
<span><a name="asio.reference.async_read_until.overload11.remarks"></a></span><a class="link" href="overload11.html#asio.reference.async_read_until.overload11.remarks">Remarks</a>
|
||||
</h6>
|
||||
<p>
|
||||
After a successful async_read_until operation, the dynamic buffer sequence
|
||||
may contain additional data beyond that which matched the regular expression.
|
||||
An application will typically leave that data in the dynamic buffer sequence
|
||||
for a subsequent async_read_until operation to examine.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.reference.async_read_until.overload11.h2"></a>
|
||||
<span><a name="asio.reference.async_read_until.overload11.example"></a></span><a class="link" href="overload11.html#asio.reference.async_read_until.overload11.example">Example</a>
|
||||
</h6>
|
||||
<p>
|
||||
To asynchronously read data into a <code class="computeroutput">std::string</code> until a CR-LF
|
||||
sequence is encountered:
|
||||
</p>
|
||||
<pre class="programlisting">std::string data;
|
||||
...
|
||||
void handler(const asio::error_code& e, std::size_t size)
|
||||
{
|
||||
if (!e)
|
||||
{
|
||||
std::string line = data.substr(0, n);
|
||||
data.erase(0, n);
|
||||
...
|
||||
}
|
||||
}
|
||||
...
|
||||
asio::async_read_until(s, data,
|
||||
boost::regex("\r\n"), handler);
|
||||
</pre>
|
||||
<p>
|
||||
After the <code class="computeroutput">async_read_until</code> operation completes successfully,
|
||||
the string <code class="computeroutput">data</code> contains the data which matched the regular
|
||||
expression:
|
||||
</p>
|
||||
<pre class="programlisting">{ 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... }
|
||||
</pre>
|
||||
<p>
|
||||
The call to <code class="computeroutput">substr</code> then extracts the data up to and including
|
||||
the match, so that the string <code class="computeroutput">line</code> contains:
|
||||
</p>
|
||||
<pre class="programlisting">{ 'a', 'b', ..., 'c', '\r', '\n' }
|
||||
</pre>
|
||||
<p>
|
||||
After the call to <code class="computeroutput">erase</code>, the remaining data is left in the
|
||||
string <code class="computeroutput">data</code> as follows:
|
||||
</p>
|
||||
<pre class="programlisting">{ 'd', 'e', ... }
|
||||
</pre>
|
||||
<p>
|
||||
This data may be the start of a new line, to be extracted by a subsequent
|
||||
<code class="computeroutput">async_read_until</code> operation.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload10.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_read_until.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="overload12.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,224 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>async_read_until (12 of 12 overloads)</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../async_read_until.html" title="async_read_until">
|
||||
<link rel="prev" href="overload11.html" title="async_read_until (11 of 12 overloads)">
|
||||
<link rel="next" href="../async_result.html" title="async_result">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload11.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_read_until.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="../async_result.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.reference.async_read_until.overload12"></a><a class="link" href="overload12.html" title="async_read_until (12 of 12 overloads)">async_read_until
|
||||
(12 of 12 overloads)</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Start an asynchronous operation to read data into a dynamic buffer sequence
|
||||
until a function object indicates a match.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename <a class="link" href="../AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">AsyncReadStream</a>,
|
||||
typename <a class="link" href="../DynamicBuffer_v2.html" title="Dynamic buffer requirements (version 2)">DynamicBuffer_v2</a>,
|
||||
typename MatchCondition,
|
||||
typename <a class="link" href="../ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> async_read_until(
|
||||
AsyncReadStream & s,
|
||||
DynamicBuffer_v2 buffers,
|
||||
MatchCondition match_condition,
|
||||
ReadHandler && handler = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>,
|
||||
typename enable_if< is_match_condition< MatchCondition >::value &&is_dynamic_buffer_v2< DynamicBuffer_v2 >::value >::type * = 0);
|
||||
</pre>
|
||||
<p>
|
||||
This function is used to asynchronously read data into the specified dynamic
|
||||
buffer sequence until a user-defined match condition function object, when
|
||||
applied to the data contained in the dynamic buffer sequence, indicates
|
||||
a successful match. The function call always returns immediately. The asynchronous
|
||||
operation will continue until one of the following conditions is true:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
The match condition function object returns a std::pair where the second
|
||||
element evaluates to true.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
An error occurred.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
This operation is implemented in terms of zero or more calls to the stream's
|
||||
async_read_some function, and is known as a <span class="emphasis"><em>composed operation</em></span>.
|
||||
If the match condition function object already indicates a match, this
|
||||
asynchronous operation completes immediately. The program must ensure that
|
||||
the stream performs no other read operations (such as async_read, async_read_until,
|
||||
the stream's async_read_some function, or any other composed operations
|
||||
that perform reads) until this operation completes.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.reference.async_read_until.overload12.h0"></a>
|
||||
<span><a name="asio.reference.async_read_until.overload12.parameters"></a></span><a class="link" href="overload12.html#asio.reference.async_read_until.overload12.parameters">Parameters</a>
|
||||
</h6>
|
||||
<div class="variablelist">
|
||||
<p class="title"><b></b></p>
|
||||
<dl>
|
||||
<dt><span class="term">s</span></dt>
|
||||
<dd><p>
|
||||
The stream from which the data is to be read. The type must support
|
||||
the AsyncReadStream concept.
|
||||
</p></dd>
|
||||
<dt><span class="term">buffers</span></dt>
|
||||
<dd><p>
|
||||
The dynamic buffer sequence into which the data will be read. Although
|
||||
the buffers object may be copied as necessary, ownership of the underlying
|
||||
memory blocks is retained by the caller, which must guarantee that
|
||||
they remain valid until the handler is called.
|
||||
</p></dd>
|
||||
<dt><span class="term">match_condition</span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
The function object to be called to determine whether a match exists.
|
||||
The signature of the function object must be:
|
||||
</p>
|
||||
<pre class="programlisting">pair<iterator, bool> match_condition(iterator begin, iterator end);
|
||||
</pre>
|
||||
<p>
|
||||
where <code class="computeroutput">iterator</code> represents the type:
|
||||
</p>
|
||||
<pre class="programlisting">buffers_iterator<typename DynamicBuffer_v2::const_buffers_type>
|
||||
</pre>
|
||||
<p>
|
||||
The iterator parameters <code class="computeroutput">begin</code> and <code class="computeroutput">end</code> define
|
||||
the range of bytes to be scanned to determine whether there is a
|
||||
match. The <code class="computeroutput">first</code> member of the return value is an iterator
|
||||
marking one-past-the-end of the bytes that have been consumed by
|
||||
the match function. This iterator is used to calculate the <code class="computeroutput">begin</code>
|
||||
parameter for any subsequent invocation of the match condition. The
|
||||
<code class="computeroutput">second</code> member of the return value is true if a match
|
||||
has been found, false otherwise.
|
||||
</p>
|
||||
</dd>
|
||||
<dt><span class="term">handler</span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
The handler to be called when the read operation completes. Copies
|
||||
will be made of the handler as required. The function signature of
|
||||
the handler must be:
|
||||
</p>
|
||||
<pre class="programlisting">void handler(
|
||||
// Result of operation.
|
||||
const asio::error_code& error,
|
||||
|
||||
// The number of bytes in the dynamic buffer sequence's
|
||||
// get area that have been fully consumed by the match
|
||||
// function. O if an error occurred.
|
||||
std::size_t bytes_transferred
|
||||
);
|
||||
</pre>
|
||||
<p>
|
||||
Regardless of whether the asynchronous operation completes immediately
|
||||
or not, the handler will not be invoked from within this function.
|
||||
On immediate completion, invocation of the handler will be performed
|
||||
in a manner equivalent to using <a class="link" href="../post.html" title="post"><code class="computeroutput">post</code></a>.
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<h6>
|
||||
<a name="asio.reference.async_read_until.overload12.h1"></a>
|
||||
<span><a name="asio.reference.async_read_until.overload12.remarks"></a></span><a class="link" href="overload12.html#asio.reference.async_read_until.overload12.remarks">Remarks</a>
|
||||
</h6>
|
||||
<p>
|
||||
After a successful async_read_until operation, the dynamic buffer sequence
|
||||
may contain additional data beyond that which matched the function object.
|
||||
An application will typically leave that data in the dynamic buffer sequence
|
||||
for a subsequent async_read_until operation to examine.
|
||||
</p>
|
||||
<p>
|
||||
The default implementation of the <code class="computeroutput">is_match_condition</code> type
|
||||
trait evaluates to true for function pointers and function objects with
|
||||
a <code class="computeroutput">result_type</code> typedef. It must be specialised for other user-defined
|
||||
function objects.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.reference.async_read_until.overload12.h2"></a>
|
||||
<span><a name="asio.reference.async_read_until.overload12.examples"></a></span><a class="link" href="overload12.html#asio.reference.async_read_until.overload12.examples">Examples</a>
|
||||
</h6>
|
||||
<p>
|
||||
To asynchronously read data into a <code class="computeroutput">std::string</code> until whitespace
|
||||
is encountered:
|
||||
</p>
|
||||
<pre class="programlisting">typedef asio::buffers_iterator<
|
||||
asio::const_buffers_1> iterator;
|
||||
|
||||
std::pair<iterator, bool>
|
||||
match_whitespace(iterator begin, iterator end)
|
||||
{
|
||||
iterator i = begin;
|
||||
while (i != end)
|
||||
if (std::isspace(*i++))
|
||||
return std::make_pair(i, true);
|
||||
return std::make_pair(i, false);
|
||||
}
|
||||
...
|
||||
void handler(const asio::error_code& e, std::size_t size);
|
||||
...
|
||||
std::string data;
|
||||
asio::async_read_until(s, data, match_whitespace, handler);
|
||||
</pre>
|
||||
<p>
|
||||
To asynchronously read data into a <code class="computeroutput">std::string</code> until a matching
|
||||
character is found:
|
||||
</p>
|
||||
<pre class="programlisting">class match_char
|
||||
{
|
||||
public:
|
||||
explicit match_char(char c) : c_(c) {}
|
||||
|
||||
template <typename Iterator>
|
||||
std::pair<Iterator, bool> operator()(
|
||||
Iterator begin, Iterator end) const
|
||||
{
|
||||
Iterator i = begin;
|
||||
while (i != end)
|
||||
if (c_ == *i++)
|
||||
return std::make_pair(i, true);
|
||||
return std::make_pair(i, false);
|
||||
}
|
||||
|
||||
private:
|
||||
char c_;
|
||||
};
|
||||
|
||||
namespace asio {
|
||||
template <> struct is_match_condition<match_char>
|
||||
: public boost::true_type {};
|
||||
} // namespace asio
|
||||
...
|
||||
void handler(const asio::error_code& e, std::size_t size);
|
||||
...
|
||||
std::string data;
|
||||
asio::async_read_until(s, data, match_char('a'), handler);
|
||||
</pre>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload11.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_read_until.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="../async_result.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,181 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>async_read_until (2 of 12 overloads)</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../async_read_until.html" title="async_read_until">
|
||||
<link rel="prev" href="overload1.html" title="async_read_until (1 of 12 overloads)">
|
||||
<link rel="next" href="overload3.html" title="async_read_until (3 of 12 overloads)">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload1.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_read_until.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="overload3.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.reference.async_read_until.overload2"></a><a class="link" href="overload2.html" title="async_read_until (2 of 12 overloads)">async_read_until
|
||||
(2 of 12 overloads)</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Start an asynchronous operation to read data into a dynamic buffer sequence
|
||||
until it contains a specified delimiter.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename <a class="link" href="../AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">AsyncReadStream</a>,
|
||||
typename <a class="link" href="../DynamicBuffer_v1.html" title="Dynamic buffer requirements (version 1)">DynamicBuffer_v1</a>,
|
||||
typename <a class="link" href="../ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> async_read_until(
|
||||
AsyncReadStream & s,
|
||||
DynamicBuffer_v1 && buffers,
|
||||
string_view delim,
|
||||
ReadHandler && handler = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>,
|
||||
typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
|
||||
</pre>
|
||||
<p>
|
||||
This function is used to asynchronously read data into the specified dynamic
|
||||
buffer sequence until the dynamic buffer sequence's get area contains the
|
||||
specified delimiter. The function call always returns immediately. The
|
||||
asynchronous operation will continue until one of the following conditions
|
||||
is true:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
The get area of the dynamic buffer sequence contains the specified
|
||||
delimiter.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
An error occurred.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
This operation is implemented in terms of zero or more calls to the stream's
|
||||
async_read_some function, and is known as a <span class="emphasis"><em>composed operation</em></span>.
|
||||
If the dynamic buffer sequence's get area already contains the delimiter,
|
||||
this asynchronous operation completes immediately. The program must ensure
|
||||
that the stream performs no other read operations (such as async_read,
|
||||
async_read_until, the stream's async_read_some function, or any other composed
|
||||
operations that perform reads) until this operation completes.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.reference.async_read_until.overload2.h0"></a>
|
||||
<span><a name="asio.reference.async_read_until.overload2.parameters"></a></span><a class="link" href="overload2.html#asio.reference.async_read_until.overload2.parameters">Parameters</a>
|
||||
</h6>
|
||||
<div class="variablelist">
|
||||
<p class="title"><b></b></p>
|
||||
<dl>
|
||||
<dt><span class="term">s</span></dt>
|
||||
<dd><p>
|
||||
The stream from which the data is to be read. The type must support
|
||||
the AsyncReadStream concept.
|
||||
</p></dd>
|
||||
<dt><span class="term">buffers</span></dt>
|
||||
<dd><p>
|
||||
The dynamic buffer sequence into which the data will be read. Although
|
||||
the buffers object may be copied as necessary, ownership of the underlying
|
||||
memory blocks is retained by the caller, which must guarantee that
|
||||
they remain valid until the handler is called.
|
||||
</p></dd>
|
||||
<dt><span class="term">delim</span></dt>
|
||||
<dd><p>
|
||||
The delimiter string.
|
||||
</p></dd>
|
||||
<dt><span class="term">handler</span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
The handler to be called when the read operation completes. Copies
|
||||
will be made of the handler as required. The function signature of
|
||||
the handler must be:
|
||||
</p>
|
||||
<pre class="programlisting">void handler(
|
||||
// Result of operation.
|
||||
const asio::error_code& error,
|
||||
|
||||
// The number of bytes in the dynamic buffer sequence's
|
||||
// get area up to and including the delimiter.
|
||||
// 0 if an error occurred.
|
||||
std::size_t bytes_transferred
|
||||
);
|
||||
</pre>
|
||||
<p>
|
||||
Regardless of whether the asynchronous operation completes immediately
|
||||
or not, the handler will not be invoked from within this function.
|
||||
On immediate completion, invocation of the handler will be performed
|
||||
in a manner equivalent to using <a class="link" href="../post.html" title="post"><code class="computeroutput">post</code></a>.
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<h6>
|
||||
<a name="asio.reference.async_read_until.overload2.h1"></a>
|
||||
<span><a name="asio.reference.async_read_until.overload2.remarks"></a></span><a class="link" href="overload2.html#asio.reference.async_read_until.overload2.remarks">Remarks</a>
|
||||
</h6>
|
||||
<p>
|
||||
After a successful async_read_until operation, the dynamic buffer sequence
|
||||
may contain additional data beyond the delimiter. An application will typically
|
||||
leave that data in the dynamic buffer sequence for a subsequent async_read_until
|
||||
operation to examine.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.reference.async_read_until.overload2.h2"></a>
|
||||
<span><a name="asio.reference.async_read_until.overload2.example"></a></span><a class="link" href="overload2.html#asio.reference.async_read_until.overload2.example">Example</a>
|
||||
</h6>
|
||||
<p>
|
||||
To asynchronously read data into a <code class="computeroutput">std::string</code> until a CR-LF
|
||||
sequence is encountered:
|
||||
</p>
|
||||
<pre class="programlisting">std::string data;
|
||||
...
|
||||
void handler(const asio::error_code& e, std::size_t size)
|
||||
{
|
||||
if (!e)
|
||||
{
|
||||
std::string line = data.substr(0, n);
|
||||
data.erase(0, n);
|
||||
...
|
||||
}
|
||||
}
|
||||
...
|
||||
asio::async_read_until(s, data, "\r\n", handler);
|
||||
</pre>
|
||||
<p>
|
||||
After the <code class="computeroutput">async_read_until</code> operation completes successfully,
|
||||
the string <code class="computeroutput">data</code> contains the delimiter:
|
||||
</p>
|
||||
<pre class="programlisting">{ 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... }
|
||||
</pre>
|
||||
<p>
|
||||
The call to <code class="computeroutput">substr</code> then extracts the data up to and including
|
||||
the delimiter, so that the string <code class="computeroutput">line</code> contains:
|
||||
</p>
|
||||
<pre class="programlisting">{ 'a', 'b', ..., 'c', '\r', '\n' }
|
||||
</pre>
|
||||
<p>
|
||||
After the call to <code class="computeroutput">erase</code>, the remaining data is left in the
|
||||
string <code class="computeroutput">data</code> as follows:
|
||||
</p>
|
||||
<pre class="programlisting">{ 'd', 'e', ... }
|
||||
</pre>
|
||||
<p>
|
||||
This data may be the start of a new line, to be extracted by a subsequent
|
||||
<code class="computeroutput">async_read_until</code> operation.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload1.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_read_until.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="overload3.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,185 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>async_read_until (3 of 12 overloads)</title>
|
||||
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
|
||||
<link rel="home" href="../../../index.html" title="Asio">
|
||||
<link rel="up" href="../async_read_until.html" title="async_read_until">
|
||||
<link rel="prev" href="overload2.html" title="async_read_until (2 of 12 overloads)">
|
||||
<link rel="next" href="overload4.html" title="async_read_until (4 of 12 overloads)">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload2.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_read_until.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="overload4.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h4 class="title">
|
||||
<a name="asio.reference.async_read_until.overload3"></a><a class="link" href="overload3.html" title="async_read_until (3 of 12 overloads)">async_read_until
|
||||
(3 of 12 overloads)</a>
|
||||
</h4></div></div></div>
|
||||
<p>
|
||||
Start an asynchronous operation to read data into a dynamic buffer sequence
|
||||
until some part of its data matches a regular expression.
|
||||
</p>
|
||||
<pre class="programlisting">template<
|
||||
typename <a class="link" href="../AsyncReadStream.html" title="Buffer-oriented asynchronous read stream requirements">AsyncReadStream</a>,
|
||||
typename <a class="link" href="../DynamicBuffer_v1.html" title="Dynamic buffer requirements (version 1)">DynamicBuffer_v1</a>,
|
||||
typename <a class="link" href="../ReadHandler.html" title="Read handler requirements">ReadHandler</a> = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>>
|
||||
<a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> async_read_until(
|
||||
AsyncReadStream & s,
|
||||
DynamicBuffer_v1 && buffers,
|
||||
const boost::regex & expr,
|
||||
ReadHandler && handler = <a class="link" href="../asynchronous_operations.html#asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>,
|
||||
typename enable_if< is_dynamic_buffer_v1< typename decay< DynamicBuffer_v1 >::type >::value &&!is_dynamic_buffer_v2< typename decay< DynamicBuffer_v1 >::type >::value >::type * = 0);
|
||||
</pre>
|
||||
<p>
|
||||
This function is used to asynchronously read data into the specified dynamic
|
||||
buffer sequence until the dynamic buffer sequence's get area contains some
|
||||
data that matches a regular expression. The function call always returns
|
||||
immediately. The asynchronous operation will continue until one of the
|
||||
following conditions is true:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
|
||||
<li class="listitem">
|
||||
A substring of the dynamic buffer sequence's get area matches the regular
|
||||
expression.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
An error occurred.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
This operation is implemented in terms of zero or more calls to the stream's
|
||||
async_read_some function, and is known as a <span class="emphasis"><em>composed operation</em></span>.
|
||||
If the dynamic buffer sequence's get area already contains data that matches
|
||||
the regular expression, this asynchronous operation completes immediately.
|
||||
The program must ensure that the stream performs no other read operations
|
||||
(such as async_read, async_read_until, the stream's async_read_some function,
|
||||
or any other composed operations that perform reads) until this operation
|
||||
completes.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.reference.async_read_until.overload3.h0"></a>
|
||||
<span><a name="asio.reference.async_read_until.overload3.parameters"></a></span><a class="link" href="overload3.html#asio.reference.async_read_until.overload3.parameters">Parameters</a>
|
||||
</h6>
|
||||
<div class="variablelist">
|
||||
<p class="title"><b></b></p>
|
||||
<dl>
|
||||
<dt><span class="term">s</span></dt>
|
||||
<dd><p>
|
||||
The stream from which the data is to be read. The type must support
|
||||
the AsyncReadStream concept.
|
||||
</p></dd>
|
||||
<dt><span class="term">buffers</span></dt>
|
||||
<dd><p>
|
||||
The dynamic buffer sequence into which the data will be read. Although
|
||||
the buffers object may be copied as necessary, ownership of the underlying
|
||||
memory blocks is retained by the caller, which must guarantee that
|
||||
they remain valid until the handler is called.
|
||||
</p></dd>
|
||||
<dt><span class="term">expr</span></dt>
|
||||
<dd><p>
|
||||
The regular expression.
|
||||
</p></dd>
|
||||
<dt><span class="term">handler</span></dt>
|
||||
<dd>
|
||||
<p>
|
||||
The handler to be called when the read operation completes. Copies
|
||||
will be made of the handler as required. The function signature of
|
||||
the handler must be:
|
||||
</p>
|
||||
<pre class="programlisting">void handler(
|
||||
// Result of operation.
|
||||
const asio::error_code& error,
|
||||
|
||||
// The number of bytes in the dynamic buffer
|
||||
// sequence's get area up to and including the
|
||||
// substring that matches the regular expression.
|
||||
// 0 if an error occurred.
|
||||
std::size_t bytes_transferred
|
||||
);
|
||||
</pre>
|
||||
<p>
|
||||
Regardless of whether the asynchronous operation completes immediately
|
||||
or not, the handler will not be invoked from within this function.
|
||||
On immediate completion, invocation of the handler will be performed
|
||||
in a manner equivalent to using <a class="link" href="../post.html" title="post"><code class="computeroutput">post</code></a>.
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<h6>
|
||||
<a name="asio.reference.async_read_until.overload3.h1"></a>
|
||||
<span><a name="asio.reference.async_read_until.overload3.remarks"></a></span><a class="link" href="overload3.html#asio.reference.async_read_until.overload3.remarks">Remarks</a>
|
||||
</h6>
|
||||
<p>
|
||||
After a successful async_read_until operation, the dynamic buffer sequence
|
||||
may contain additional data beyond that which matched the regular expression.
|
||||
An application will typically leave that data in the dynamic buffer sequence
|
||||
for a subsequent async_read_until operation to examine.
|
||||
</p>
|
||||
<h6>
|
||||
<a name="asio.reference.async_read_until.overload3.h2"></a>
|
||||
<span><a name="asio.reference.async_read_until.overload3.example"></a></span><a class="link" href="overload3.html#asio.reference.async_read_until.overload3.example">Example</a>
|
||||
</h6>
|
||||
<p>
|
||||
To asynchronously read data into a <code class="computeroutput">std::string</code> until a CR-LF
|
||||
sequence is encountered:
|
||||
</p>
|
||||
<pre class="programlisting">std::string data;
|
||||
...
|
||||
void handler(const asio::error_code& e, std::size_t size)
|
||||
{
|
||||
if (!e)
|
||||
{
|
||||
std::string line = data.substr(0, n);
|
||||
data.erase(0, n);
|
||||
...
|
||||
}
|
||||
}
|
||||
...
|
||||
asio::async_read_until(s, data,
|
||||
boost::regex("\r\n"), handler);
|
||||
</pre>
|
||||
<p>
|
||||
After the <code class="computeroutput">async_read_until</code> operation completes successfully,
|
||||
the string <code class="computeroutput">data</code> contains the data which matched the regular
|
||||
expression:
|
||||
</p>
|
||||
<pre class="programlisting">{ 'a', 'b', ..., 'c', '\r', '\n', 'd', 'e', ... }
|
||||
</pre>
|
||||
<p>
|
||||
The call to <code class="computeroutput">substr</code> then extracts the data up to and including
|
||||
the match, so that the string <code class="computeroutput">line</code> contains:
|
||||
</p>
|
||||
<pre class="programlisting">{ 'a', 'b', ..., 'c', '\r', '\n' }
|
||||
</pre>
|
||||
<p>
|
||||
After the call to <code class="computeroutput">erase</code>, the remaining data is left in the
|
||||
string <code class="computeroutput">data</code> as follows:
|
||||
</p>
|
||||
<pre class="programlisting">{ 'd', 'e', ... }
|
||||
</pre>
|
||||
<p>
|
||||
This data may be the start of a new line, to be extracted by a subsequent
|
||||
<code class="computeroutput">async_read_until</code> operation.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
|
||||
Kohlhoff<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
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>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="overload2.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../async_read_until.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="overload4.html"><img src="../../../next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Loaded 100 of 4869 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user