Hi

Maybe I ask the question the wrong way.
What is the proper way for a server to limit the connections.
Even if I don't start another async_accept clients can still connect but not communicate.
That's why I called close.  Is there a better way?

Thanks
Roger


I'm trying to limit the connections made to the server.
So after creating the acceptor and accepting MAX connections I closed the acceptor.
Further connections are properly rejected.
However after one of the connections is closed by the client I attempt to re-open the acceptor
but further connections are still rejected?

Create and open:
m_acceptor(m_ioService, m_endpoint = resolve(m_ioService, host, port), true)

Async accept:
m_acceptor.async_accept(connection->socket(), boost::bind(&IpServer::handleAccept, this, aph::error, connection));

Close after max connections:
m_acceptor.close();

Reopen when a connection is available:
m_acceptor.open(m_endpoint.protocol());
m_acceptor.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
m_acceptor.bind(m_endpoint);
m_acceptor.listen();

Thanks for your time.
Roger