int main()
{
  talk_to_client::ptr new_client = talk_to_client::new_();
  
  acceptor.async_accept(new_client->sock(), std::bind(handle_accept, new_client, std::placeholders::_1));

  service.run();
}
void
handle_accept(talk_to_client::ptr client,
              const error_code &err)
{
  client->start();
  talk_to_client::ptr new_client = talk_to_client::new_();
  
  acceptor.async_accept(new_client->sock(), std::bind(handle_accept, new_client, std::placeholders::_1));
}
Example #3
0
void connection::accept(boost::shared_ptr<local_node> node, ip::tcp::acceptor& incoming)
{
	ptr_t con(new connection(node, ib));
	con->starting_connection();
	incoming.async_accept(con->link_.socket.lowest_layer(),
	                      boost::bind(&connection::connection_accepted,
	                      con,
	                      placeholders::error,
	                      boost::ref(incoming)) );
}
Example #4
0
	//开始
	void start()
	{
		sock_ptr listenSocket(new ip::tcp::socket(ios));
		////异步监听
		acc.async_accept(*listenSocket, boost::bind(&server::accept_handler, this, boost::asio::placeholders::error, listenSocket));
	}