抄《 Boost程序库完全开发指南——深入C++“准”标准库》代码居然编译不过去
#include <iostream>#include <boost/shared_ptr.hpp>using namespace boost::asio;using namespace boost;using namespace std;class server{private: io_service &ios; ip::tcp::acceptor acceptor; typedef boost::shared_ptr<ip::tcp::socket> sock_pt;public: server(io_service& io) : ios(io), acceptor(ios, ip::tcp::endpoint(ip::tcp::v4(), 6688)) { start(); } void start() { sock_pt sock(new ip::tcp::socket(ios)); acceptor.async_accept(*sock, bind(&server::accept_handler, this, aiso::placeholders::error, sock)); } void accept_handler(const system::error_code& ec, sock_pt sock) { if(ec) { return;} cout <<"client:"; cout << sock->remote_endpoint().address() <<endl; sock->async_write_some(buffer("hello asio"), bind(&server::write_handler, this, aiso::placeholders::error)); start(); } void write_handler(const system::error_code&) { cout << "send msg complete." <<endl; }};int main(){ try { cout << "Server is started." <<endl; io_service ios; server serv(ios); ios.run(); } catch(std::exception& e) { cout <<e.what() <<endl; } return 0;}