Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::asio::asyn_accept handler
From: Christopher Pisz (christopherpisz_at_[hidden])
Date: 2017-03-28 14:28:51


If I followed what you wrote in your post correctly, I would end up with:

    void start_accept()
    {
        tcp_connection::pointer new_connection =
            tcp_connection::create(acceptor_.get_io_service());

        //auto callback = std::bind(&tcp_server::handle_accept, this,
new_connection, std::placeholders::_1);
        const std::function<void(tcp_connection::pointer, const
boost::system::error_code &amp;)> callback =
            std::bind(&tcp_server::handle_accept, this, new_connection,
std::placeholders::_1);

        acceptor_.async_accept(new_connection->socket(), std::bind(callback,
this, boost::asio::placeholders::error));
    }

Which does not compile. I don't know why I'd bind something that is already
bound or what this would mean in the context of the second bind.

--
View this message in context: http://boost.2283326.n4.nabble.com/boost-asio-asyn-accept-handler-tp4693107p4693149.html
Sent from the Boost - Users mailing list archive at Nabble.com.

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