I have this code and don't know if what I would like to achieve is possible.
_acceptor.async_accept(
_connections.back()->socket(),
[this](const boost::system::error_code& ec)
{
_connections.push_back(std::make_shared<TcpConnection>(_acceptor.get_io_service()));
_acceptor.async_accept(_connections.back()->socket(), this_lambda_function);
}
);
Once a socket is accepted, I would like to reuse the handler (aka the lambda function). Is this possible? Is there a better way to accomplish this?