void Server::listen() { Connection::pointer connection = Connection::create(*this); m_acceptor.async_accept(connection->socket(), boost::bind(&Server::accept, this, connection, ba::placeholders::error)); }
void Server::accept(Connection::pointer connection, const boost::system::error_code& error) { std::string ip = connection->socket().remote_endpoint().address().to_v4().to_string(); std::cout << "-----------------------------------------\n"; std::cout << "New request coming from " << ip << std::endl; if (!error) connection->start(); else std::cout << "Server accept error : " << error.message() << std::endl; listen(); }