11 #ifndef ASIO_IMPL_CONNECT_HPP 12 #define ASIO_IMPL_CONNECT_HPP 14 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 35 template <
typename Iterator>
43 template <
typename Protocol,
typename SocketService,
typename Iterator>
47 Iterator result =
connect(s, begin, ec);
52 template <
typename Protocol,
typename SocketService,
typename Iterator>
59 template <
typename Protocol,
typename SocketService,
typename Iterator>
64 Iterator result =
connect(s, begin, end, ec);
69 template <
typename Protocol,
typename SocketService,
typename Iterator>
76 template <
typename Protocol,
typename SocketService,
77 typename Iterator,
typename ConnectCondition>
82 Iterator result =
connect(s, begin, connect_condition, ec);
87 template <
typename Protocol,
typename SocketService,
88 typename Iterator,
typename ConnectCondition>
93 return connect(s, begin, Iterator(), connect_condition, ec);
96 template <
typename Protocol,
typename SocketService,
97 typename Iterator,
typename ConnectCondition>
102 Iterator result =
connect(s, begin, end, connect_condition, ec);
107 template <
typename Protocol,
typename SocketService,
108 typename Iterator,
typename ConnectCondition>
115 for (Iterator iter = begin; iter !=
end; ++iter)
136 template <
typename ConnectCondition>
142 : connect_condition_(connect_condition)
146 template <
typename Iterator>
148 Iterator& iter, Iterator&
end)
151 iter = connect_condition_(ec, static_cast<const Iterator&>(iter));
155 ConnectCondition connect_condition_;
168 template <
typename Iterator>
174 template <
typename Protocol,
typename SocketService,
typename Iterator,
175 typename ConnectCondition,
typename ComposedConnectHandler>
180 const Iterator&
begin,
const Iterator&
end,
182 ComposedConnectHandler& handler)
192 #if defined(ASIO_HAS_MOVE) 212 #endif // defined(ASIO_HAS_MOVE) 216 switch (start_ = start)
221 this->check_condition(ec, iter_, end_);
226 socket_.async_connect(*iter_,
243 if (!socket_.is_open())
255 handler_(static_cast<const asio::error_code&>(ec),
256 static_cast<const Iterator&>(iter_));
268 template <
typename Protocol,
typename SocketService,
typename Iterator,
269 typename ConnectCondition,
typename ComposedConnectHandler>
272 ConnectCondition, ComposedConnectHandler>* this_handler)
275 size, this_handler->handler_);
278 template <
typename Protocol,
typename SocketService,
typename Iterator,
279 typename ConnectCondition,
typename ComposedConnectHandler>
282 ConnectCondition, ComposedConnectHandler>* this_handler)
285 pointer, size, this_handler->handler_);
288 template <
typename Protocol,
typename SocketService,
typename Iterator,
289 typename ConnectCondition,
typename ComposedConnectHandler>
292 ConnectCondition, ComposedConnectHandler>* this_handler)
295 this_handler->handler_);
298 template <
typename Function,
typename Protocol,
299 typename SocketService,
typename Iterator,
300 typename ConnectCondition,
typename ComposedConnectHandler>
303 ConnectCondition, ComposedConnectHandler>* this_handler)
306 function, this_handler->handler_);
309 template <
typename Function,
typename Protocol,
310 typename SocketService,
typename Iterator,
311 typename ConnectCondition,
typename ComposedConnectHandler>
314 ConnectCondition, ComposedConnectHandler>* this_handler)
317 function, this_handler->handler_);
321 template <
typename Protocol,
typename SocketService,
322 typename Iterator,
typename ComposedConnectHandler>
331 ComposedConnectHandler, handler, Iterator) type_check;
340 begin, Iterator(), detail::default_connect_condition(), init.
handler)(
346 template <
typename Protocol,
typename SocketService,
347 typename Iterator,
typename ComposedConnectHandler>
351 Iterator begin, Iterator
end,
357 ComposedConnectHandler, handler, Iterator) type_check;
372 template <
typename Protocol,
typename SocketService,
typename Iterator,
373 typename ConnectCondition,
typename ComposedConnectHandler>
383 ComposedConnectHandler, handler, Iterator) type_check;
398 template <
typename Protocol,
typename SocketService,
typename Iterator,
399 typename ConnectCondition,
typename ComposedConnectHandler>
403 Iterator begin, Iterator end, ConnectCondition connect_condition,
409 ComposedConnectHandler, handler, Iterator) type_check;
428 #endif // ASIO_IMPL_CONNECT_HPP
void asio_handler_deallocate(void *pointer, std::size_t size, binder1< Handler, Arg1 > *this_handler)
base_from_connect_condition(const ConnectCondition &connect_condition)
void check_condition(const asio::error_code &ec, Iterator &iter, Iterator &end)
void throw_error(const asio::error_code &err)
SocketService Iterator begin
connect_op(basic_socket< Protocol, SocketService > &sock, const Iterator &begin, const Iterator &end, const ConnectCondition &connect_condition, ComposedConnectHandler &handler)
void * asio_handler_allocate(std::size_t size, binder1< Handler, Arg1 > *this_handler)
basic_socket< Protocol, SocketService > & socket_
asio::basic_streambuf< Allocator > MatchCondition enable_if< is_match_condition< MatchCondition >::value >::type *detail::async_result_init< ReadHandler, void(asio::error_code, std::size_t)> init(ASIO_MOVE_CAST(ReadHandler)(handler))
#define ASIO_HANDLER_TYPE(h, sig)
Iterator connect(basic_socket< Protocol, SocketService > &s, Iterator begin)
Establishes a socket connection by trying each endpoint in a sequence.
void operator()(asio::error_code ec, int start=0)
ASIO_INITFN_RESULT_TYPE(ComposedConnectHandler, void(asio::error_code, Iterator)) async_connect(basic_socket< Protocol
void invoke(Function &function, Context &context)
ComposedConnectHandler handler_
Iterator operator()(const asio::error_code &, Iterator next)
SocketService Iterator ConnectCondition connect_condition
#define ASIO_COMPOSED_CONNECT_HANDLER_CHECK(handler_type, handler, iter_type)
void asio_handler_invoke(Function &function, binder1< Handler, Arg1 > *this_handler)
asio::basic_streambuf< Allocator > CompletionCondition ASIO_MOVE_ARG(ReadHandler) handler)
bool is_continuation(Context &context)
Class to represent an error code value.
void deallocate(void *p, std::size_t s, Handler &h)
void check_condition(const asio::error_code &, Iterator &, Iterator &)
void close()
Close the socket.
base_from_connect_condition(const default_connect_condition &)
void * allocate(std::size_t s, Handler &h)
handler_type< Handler, Signature >::type handler
Provides socket functionality.
SocketService Iterator Iterator end
#define ASIO_MOVE_CAST(type)
binder1< Handler, Arg1 > bind_handler(Handler handler, const Arg1 &arg1)
async_result< typename handler_type< Handler, Signature >::type > result
bool asio_handler_is_continuation(binder1< Handler, Arg1 > *this_handler)
void connect(const endpoint_type &peer_endpoint)
Connect the socket to the specified endpoint.