예제 #1
0
 inline accepting_source::element_type *
 accepting_source::copy_next(iterator_range<element_type *> destination)
 {
     assert(m_acceptor);
     assert(m_yield);
     for (auto &client : destination)
     {
         assert(m_acceptor);
         client = std::make_shared<boost::asio::ip::tcp::socket>(
             m_acceptor->get_io_service());
         assert(m_yield);
         m_acceptor->async_accept(*client, *m_yield);
     }
     return destination.end();
 }
예제 #2
0
	void start_accept()
	{
		using namespace std;
		using namespace boost::asio::ip;

		auto connection = make_shared<tcp_connection>(_acceptor.get_io_service());
		_acceptor.async_accept(connection->socket(), [connection, this](const boost::system::error_code &ec)
		{
			if (!ec)
			{
				connection->send_string();
			}

			this->start_accept();
		});
	}