#include #include #include #include namespace ph = std::placeholders; namespace io = asio; struct handler_t { io::ip::tcp::socket socket; handler_t(io::io_service& io) : socket(io) { socket.async_connect({ io::ip::tcp::v6(), 22 }, std::bind(&handler_t::on_connect, this, ph::_1)); } void on_connect(const std::error_code& ec) { std::cout << ec.message() << std::endl; } }; int main() { io::io_service io; handler_t handler(io); io.run(); return 0; }