• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>basic_socket_acceptor::async_accept (2 of 8 overloads)</title>
5<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7<link rel="home" href="../../../../boost_asio.html" title="Boost.Asio">
8<link rel="up" href="../async_accept.html" title="basic_socket_acceptor::async_accept">
9<link rel="prev" href="overload1.html" title="basic_socket_acceptor::async_accept (1 of 8 overloads)">
10<link rel="next" href="overload3.html" title="basic_socket_acceptor::async_accept (3 of 8 overloads)">
11</head>
12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13<table cellpadding="2" width="100%"><tr>
14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
15<td align="center"><a href="../../../../../../index.html">Home</a></td>
16<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
20</tr></table>
21<hr>
22<div class="spirit-nav">
23<a accesskey="p" href="overload1.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../async_accept.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../boost_asio.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="overload3.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h5 class="title">
27<a name="boost_asio.reference.basic_socket_acceptor.async_accept.overload2"></a><a class="link" href="overload2.html" title="basic_socket_acceptor::async_accept (2 of 8 overloads)">basic_socket_acceptor::async_accept
28          (2 of 8 overloads)</a>
29</h5></div></div></div>
30<p>
31            Start an asynchronous accept.
32          </p>
33<pre class="programlisting">template&lt;
34    typename <a class="link" href="../../Executor1.html" title="Executor requirements">Executor1</a>,
35    typename <a class="link" href="../../AcceptHandler.html" title="Accept handler requirements">AcceptHandler</a> = <a class="link" href="../../asynchronous_operations.html#boost_asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>&gt;
36<a class="link" href="../../asynchronous_operations.html#boost_asio.reference.asynchronous_operations.automatic_deduction_of_initiating_function_return_type"><span class="emphasis"><em>DEDUCED</em></span></a> async_accept(
37    basic_socket&lt; protocol_type, Executor1 &gt; &amp; peer,
38    endpoint_type &amp; peer_endpoint,
39    AcceptHandler &amp;&amp; handler = <a class="link" href="../../asynchronous_operations.html#boost_asio.reference.asynchronous_operations.default_completion_tokens"><span class="emphasis"><em>DEFAULT</em></span></a>);
40</pre>
41<p>
42            This function is used to asynchronously accept a new connection into
43            a socket, and additionally obtain the endpoint of the remote peer. The
44            function call always returns immediately.
45          </p>
46<h6>
47<a name="boost_asio.reference.basic_socket_acceptor.async_accept.overload2.h0"></a>
48            <span class="phrase"><a name="boost_asio.reference.basic_socket_acceptor.async_accept.overload2.parameters"></a></span><a class="link" href="overload2.html#boost_asio.reference.basic_socket_acceptor.async_accept.overload2.parameters">Parameters</a>
49          </h6>
50<div class="variablelist">
51<p class="title"><b></b></p>
52<dl class="variablelist">
53<dt><span class="term">peer</span></dt>
54<dd><p>
55                  The socket into which the new connection will be accepted. Ownership
56                  of the peer object is retained by the caller, which must guarantee
57                  that it is valid until the handler is called.
58                </p></dd>
59<dt><span class="term">peer_endpoint</span></dt>
60<dd><p>
61                  An endpoint object into which the endpoint of the remote peer will
62                  be written. Ownership of the peer_endpoint object is retained by
63                  the caller, which must guarantee that it is valid until the handler
64                  is called.
65                </p></dd>
66<dt><span class="term">handler</span></dt>
67<dd>
68<p>
69                  The handler to be called when the accept operation completes. Copies
70                  will be made of the handler as required. The function signature
71                  of the handler must be:
72</p>
73<pre class="programlisting">void handler(
74  const boost::system::error_code&amp; error // Result of operation.
75);
76</pre>
77<p>
78                  Regardless of whether the asynchronous operation completes immediately
79                  or not, the handler will not be invoked from within this function.
80                  On immediate completion, invocation of the handler will be performed
81                  in a manner equivalent to using <a class="link" href="../../post.html" title="post"><code class="computeroutput">post</code></a>.
82                </p>
83</dd>
84</dl>
85</div>
86</div>
87<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
88<td align="left"></td>
89<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
90      Kohlhoff<p>
91        Distributed under the Boost Software License, Version 1.0. (See accompanying
92        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>)
93      </p>
94</div></td>
95</tr></table>
96<hr>
97<div class="spirit-nav">
98<a accesskey="p" href="overload1.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../async_accept.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../boost_asio.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="overload3.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
99</div>
100</body>
101</html>
102