| 57 | } |
| 58 | |
| 59 | void connect(const tcp::resolver::results_type& endpoints) |
| 60 | { |
| 61 | boost::asio::async_connect(socket_.lowest_layer(), endpoints, |
| 62 | [this](const boost::system::error_code& error, |
| 63 | const tcp::endpoint& /*endpoint*/) |
| 64 | { |
| 65 | if (!error) |
| 66 | { |
| 67 | handshake(); |
| 68 | } |
| 69 | else |
| 70 | { |
| 71 | std::cout << "Connect failed: " << error.message() << "\n"; |
| 72 | } |
| 73 | }); |
| 74 | } |
| 75 | |
| 76 | void handshake() |
| 77 | { |