Boost logo

Boost Users :

Subject: [Boost-users] Connection refused after close then open.
From: Doak, Roger (GE Healthcare) (Roger.Doak_at_[hidden])
Date: 2010-09-15 09:46:30


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



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net