Connection refused after close then open

Hi I'm trying to limit the connections made to the server. So after creating the acceptor and accepting MAX connections I closed the acceptor. If there is a better way please let me know. 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(); m_acceptor.async_accept(connection->socket(), boost::bind(&IpServer::handleAccept, this, aph::error, connection)); Thank you for your time. Roger
participants (1)
-
Doak, Roger (GE Healthcare)