MCPcopy Create free account
hub / github.com/boostorg/asio / start_connect

Method start_connect

example/cpp11/timeouts/async_tcp_client.cpp:123–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121
122private:
123 void start_connect(tcp::resolver::results_type::iterator endpoint_iter)
124 {
125 if (endpoint_iter != endpoints_.end())
126 {
127 std::cout << "Trying " << endpoint_iter->endpoint() << "...\n";
128
129 // Set a deadline for the connect operation.
130 deadline_.expires_after(std::chrono::seconds(60));
131
132 // Start the asynchronous connect operation.
133 socket_.async_connect(endpoint_iter->endpoint(),
134 std::bind(&client::handle_connect,
135 this, _1, endpoint_iter));
136 }
137 else
138 {
139 // There are no more endpoints to try. Shut down the client.
140 stop();
141 }
142 }
143
144 void handle_connect(const boost::system::error_code& error,
145 tcp::resolver::results_type::iterator endpoint_iter)

Callers

nothing calls this directly

Calls 5

bindFunction · 0.50
endMethod · 0.45
endpointMethod · 0.45
expires_afterMethod · 0.45
async_connectMethod · 0.45

Tested by

no test coverage detected