本文整理汇总了C++中tcp::acceptor::get_io_service方法的典型用法代码示例。如果您正苦于以下问题:C++ acceptor::get_io_service方法的具体用法?C++ acceptor::get_io_service怎么用?C++ acceptor::get_io_service使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tcp::acceptor
的用法示例。
在下文中一共展示了acceptor::get_io_service方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: start_accept
void start_accept()
{
tcp_connection::pointer new_connection = tcp_connection::create(acceptor_.get_io_service());
acceptor_.async_accept(new_connection->socket(),
boost::bind(&tcp_server::handle_accept, this, new_connection,
boost::asio::placeholders::error));
}
示例2: start_accept
void start_accept()
{
// Create a new connection to handle a client. Passing a reference
// to db to each connection poses no problem since the server is
// single-threaded.
//
DbConnection::Pointer new_connection =
DbConnection::create(acceptor.get_io_service());
// Asynchronously wait to accept a new client
//
acceptor.async_accept(new_connection->get_socket(),
boost::bind(&DbServerImpl::handle_accept, this, new_connection,
asio::placeholders::error));
}
示例3: start
void TcpServer::start()
{
TcpConnection::SP_TCPCONNECTION spConnection = TcpConnection::create(m_acceptor.get_io_service());
m_acceptor.async_accept(spConnection->socket(),
boost::bind(&TcpServer::OnAccept, this, spConnection, boost::asio::placeholders::error));
}