#include #include #include #include #include #include using boost::asio::ip::tcp; //using boost::asio; void connect_handler(void);//const boost::system::error_code); int main() { boost::asio::io_service service; tcp::endpoint ep(boost::asio::ip::address::from_string("127.0.0.1"), 2001); tcp::socket sock(service); sock.async_connect(ep, boost::bind(connect_handler)); //sock.connect(ep, connect_handler); service.run(); } void connect_handler(void)//const boost::system::error_code & ec) { // here we know we connected successfully // if ec indicates success std::cout<<"Connected!"<