1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>connect</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="../reference.html" title="Reference"> 9<link rel="prev" href="co_spawn/overload6.html" title="co_spawn (6 of 6 overloads)"> 10<link rel="next" href="connect/overload1.html" title="connect (1 of 12 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="co_spawn/overload6.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.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="connect/overload1.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a> 24</div> 25<div class="section"> 26<div class="titlepage"><div><div><h3 class="title"> 27<a name="boost_asio.reference.connect"></a><a class="link" href="connect.html" title="connect">connect</a> 28</h3></div></div></div> 29<p> 30 <a class="indexterm" name="boost_asio.indexterm.connect"></a> 31The <code class="computeroutput">connect</code> function is a 32 composed operation that establishes a socket connection by trying each endpoint 33 in a sequence. 34 </p> 35<p> 36 Establishes a socket connection by trying each endpoint in a sequence. 37 </p> 38<pre class="programlisting">template< 39 typename <a class="link" href="Protocol.html" title="Protocol requirements">Protocol</a>, 40 typename <a class="link" href="Executor1.html" title="Executor requirements">Executor</a>, 41 typename <a class="link" href="EndpointSequence.html" title="Endpoint sequence requirements">EndpointSequence</a>> 42Protocol::endpoint <a class="link" href="connect/overload1.html" title="connect (1 of 12 overloads)">connect</a>( 43 basic_socket< Protocol, Executor > & s, 44 const EndpointSequence & endpoints, 45 typename enable_if< is_endpoint_sequence< EndpointSequence >::value >::type * = 0); 46 <span class="emphasis"><em>» <a class="link" href="connect/overload1.html" title="connect (1 of 12 overloads)">more...</a></em></span> 47 48template< 49 typename <a class="link" href="Protocol.html" title="Protocol requirements">Protocol</a>, 50 typename <a class="link" href="Executor1.html" title="Executor requirements">Executor</a>, 51 typename <a class="link" href="EndpointSequence.html" title="Endpoint sequence requirements">EndpointSequence</a>> 52Protocol::endpoint <a class="link" href="connect/overload2.html" title="connect (2 of 12 overloads)">connect</a>( 53 basic_socket< Protocol, Executor > & s, 54 const EndpointSequence & endpoints, 55 boost::system::error_code & ec, 56 typename enable_if< is_endpoint_sequence< EndpointSequence >::value >::type * = 0); 57 <span class="emphasis"><em>» <a class="link" href="connect/overload2.html" title="connect (2 of 12 overloads)">more...</a></em></span> 58</pre> 59<p> 60 (Deprecated: Use range overload.) Establishes a socket connection by trying 61 each endpoint in a sequence. 62 </p> 63<pre class="programlisting">template< 64 typename <a class="link" href="Protocol.html" title="Protocol requirements">Protocol</a>, 65 typename <a class="link" href="Executor1.html" title="Executor requirements">Executor</a>, 66 typename Iterator> 67Iterator <a class="link" href="connect/overload3.html" title="connect (3 of 12 overloads)">connect</a>( 68 basic_socket< Protocol, Executor > & s, 69 Iterator begin, 70 typename enable_if<!is_endpoint_sequence< Iterator >::value >::type * = 0); 71 <span class="emphasis"><em>» <a class="link" href="connect/overload3.html" title="connect (3 of 12 overloads)">more...</a></em></span> 72 73template< 74 typename <a class="link" href="Protocol.html" title="Protocol requirements">Protocol</a>, 75 typename <a class="link" href="Executor1.html" title="Executor requirements">Executor</a>, 76 typename Iterator> 77Iterator <a class="link" href="connect/overload4.html" title="connect (4 of 12 overloads)">connect</a>( 78 basic_socket< Protocol, Executor > & s, 79 Iterator begin, 80 boost::system::error_code & ec, 81 typename enable_if<!is_endpoint_sequence< Iterator >::value >::type * = 0); 82 <span class="emphasis"><em>» <a class="link" href="connect/overload4.html" title="connect (4 of 12 overloads)">more...</a></em></span> 83</pre> 84<p> 85 Establishes a socket connection by trying each endpoint in a sequence. 86 </p> 87<pre class="programlisting">template< 88 typename <a class="link" href="Protocol.html" title="Protocol requirements">Protocol</a>, 89 typename <a class="link" href="Executor1.html" title="Executor requirements">Executor</a>, 90 typename Iterator> 91Iterator <a class="link" href="connect/overload5.html" title="connect (5 of 12 overloads)">connect</a>( 92 basic_socket< Protocol, Executor > & s, 93 Iterator begin, 94 Iterator end); 95 <span class="emphasis"><em>» <a class="link" href="connect/overload5.html" title="connect (5 of 12 overloads)">more...</a></em></span> 96 97template< 98 typename <a class="link" href="Protocol.html" title="Protocol requirements">Protocol</a>, 99 typename <a class="link" href="Executor1.html" title="Executor requirements">Executor</a>, 100 typename Iterator> 101Iterator <a class="link" href="connect/overload6.html" title="connect (6 of 12 overloads)">connect</a>( 102 basic_socket< Protocol, Executor > & s, 103 Iterator begin, 104 Iterator end, 105 boost::system::error_code & ec); 106 <span class="emphasis"><em>» <a class="link" href="connect/overload6.html" title="connect (6 of 12 overloads)">more...</a></em></span> 107 108template< 109 typename <a class="link" href="Protocol.html" title="Protocol requirements">Protocol</a>, 110 typename <a class="link" href="Executor1.html" title="Executor requirements">Executor</a>, 111 typename <a class="link" href="EndpointSequence.html" title="Endpoint sequence requirements">EndpointSequence</a>, 112 typename <a class="link" href="ConnectCondition.html" title="Connect condition requirements">ConnectCondition</a>> 113Protocol::endpoint <a class="link" href="connect/overload7.html" title="connect (7 of 12 overloads)">connect</a>( 114 basic_socket< Protocol, Executor > & s, 115 const EndpointSequence & endpoints, 116 ConnectCondition connect_condition, 117 typename enable_if< is_endpoint_sequence< EndpointSequence >::value >::type * = 0); 118 <span class="emphasis"><em>» <a class="link" href="connect/overload7.html" title="connect (7 of 12 overloads)">more...</a></em></span> 119 120template< 121 typename <a class="link" href="Protocol.html" title="Protocol requirements">Protocol</a>, 122 typename <a class="link" href="Executor1.html" title="Executor requirements">Executor</a>, 123 typename <a class="link" href="EndpointSequence.html" title="Endpoint sequence requirements">EndpointSequence</a>, 124 typename <a class="link" href="ConnectCondition.html" title="Connect condition requirements">ConnectCondition</a>> 125Protocol::endpoint <a class="link" href="connect/overload8.html" title="connect (8 of 12 overloads)">connect</a>( 126 basic_socket< Protocol, Executor > & s, 127 const EndpointSequence & endpoints, 128 ConnectCondition connect_condition, 129 boost::system::error_code & ec, 130 typename enable_if< is_endpoint_sequence< EndpointSequence >::value >::type * = 0); 131 <span class="emphasis"><em>» <a class="link" href="connect/overload8.html" title="connect (8 of 12 overloads)">more...</a></em></span> 132</pre> 133<p> 134 (Deprecated: Use range overload.) Establishes a socket connection by trying 135 each endpoint in a sequence. 136 </p> 137<pre class="programlisting">template< 138 typename <a class="link" href="Protocol.html" title="Protocol requirements">Protocol</a>, 139 typename <a class="link" href="Executor1.html" title="Executor requirements">Executor</a>, 140 typename Iterator, 141 typename <a class="link" href="ConnectCondition.html" title="Connect condition requirements">ConnectCondition</a>> 142Iterator <a class="link" href="connect/overload9.html" title="connect (9 of 12 overloads)">connect</a>( 143 basic_socket< Protocol, Executor > & s, 144 Iterator begin, 145 ConnectCondition connect_condition, 146 typename enable_if<!is_endpoint_sequence< Iterator >::value >::type * = 0); 147 <span class="emphasis"><em>» <a class="link" href="connect/overload9.html" title="connect (9 of 12 overloads)">more...</a></em></span> 148 149template< 150 typename <a class="link" href="Protocol.html" title="Protocol requirements">Protocol</a>, 151 typename <a class="link" href="Executor1.html" title="Executor requirements">Executor</a>, 152 typename Iterator, 153 typename <a class="link" href="ConnectCondition.html" title="Connect condition requirements">ConnectCondition</a>> 154Iterator <a class="link" href="connect/overload10.html" title="connect (10 of 12 overloads)">connect</a>( 155 basic_socket< Protocol, Executor > & s, 156 Iterator begin, 157 ConnectCondition connect_condition, 158 boost::system::error_code & ec, 159 typename enable_if<!is_endpoint_sequence< Iterator >::value >::type * = 0); 160 <span class="emphasis"><em>» <a class="link" href="connect/overload10.html" title="connect (10 of 12 overloads)">more...</a></em></span> 161</pre> 162<p> 163 Establishes a socket connection by trying each endpoint in a sequence. 164 </p> 165<pre class="programlisting">template< 166 typename <a class="link" href="Protocol.html" title="Protocol requirements">Protocol</a>, 167 typename <a class="link" href="Executor1.html" title="Executor requirements">Executor</a>, 168 typename Iterator, 169 typename <a class="link" href="ConnectCondition.html" title="Connect condition requirements">ConnectCondition</a>> 170Iterator <a class="link" href="connect/overload11.html" title="connect (11 of 12 overloads)">connect</a>( 171 basic_socket< Protocol, Executor > & s, 172 Iterator begin, 173 Iterator end, 174 ConnectCondition connect_condition); 175 <span class="emphasis"><em>» <a class="link" href="connect/overload11.html" title="connect (11 of 12 overloads)">more...</a></em></span> 176 177template< 178 typename <a class="link" href="Protocol.html" title="Protocol requirements">Protocol</a>, 179 typename <a class="link" href="Executor1.html" title="Executor requirements">Executor</a>, 180 typename Iterator, 181 typename <a class="link" href="ConnectCondition.html" title="Connect condition requirements">ConnectCondition</a>> 182Iterator <a class="link" href="connect/overload12.html" title="connect (12 of 12 overloads)">connect</a>( 183 basic_socket< Protocol, Executor > & s, 184 Iterator begin, 185 Iterator end, 186 ConnectCondition connect_condition, 187 boost::system::error_code & ec); 188 <span class="emphasis"><em>» <a class="link" href="connect/overload12.html" title="connect (12 of 12 overloads)">more...</a></em></span> 189</pre> 190<h5> 191<a name="boost_asio.reference.connect.h0"></a> 192 <span class="phrase"><a name="boost_asio.reference.connect.requirements"></a></span><a class="link" href="connect.html#boost_asio.reference.connect.requirements">Requirements</a> 193 </h5> 194<p> 195 <span class="emphasis"><em>Header: </em></span><code class="literal">boost/asio/connect.hpp</code> 196 </p> 197<p> 198 <span class="emphasis"><em>Convenience header: </em></span><code class="literal">boost/asio.hpp</code> 199 </p> 200</div> 201<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 202<td align="left"></td> 203<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M. 204 Kohlhoff<p> 205 Distributed under the Boost Software License, Version 1.0. (See accompanying 206 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>) 207 </p> 208</div></td> 209</tr></table> 210<hr> 211<div class="spirit-nav"> 212<a accesskey="p" href="co_spawn/overload6.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.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="connect/overload1.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a> 213</div> 214</body> 215</html> 216