
I am looking at the example source at http://www.boost.org/doc/libs/1_62_0/doc/html/boost_asio/tutorial/tutdaytime... It passes their own connection class to the accept handler as an argument: acceptor_.async_accept(new_connection->socket(), boost::bind(&tcp_server::handle_accept, this, new_connection, boost::asio::placeholders::error)); I tried to implement a class method that would do the same: void ServerSocketASIO::Listen(boost::asio::ip::tcp::acceptor & acceptor, std::function<void(ServerSocketASIO *, const boost::system::error_code &)> callback) { acceptor.async_accept(m_socket, callback); m_connectionState = LISTENING; } but when I compile, I get errors that say AcceptHandler type requirements not met If I implement it this way: void ServerSocketASIO::Listen(boost::asio::ip::tcp::acceptor & acceptor, std::function<void(const boost::system::error_code &)> callback) { acceptor.async_accept(m_socket, callback); m_connectionState = LISTENING; } It compiles, but I would need the actual connection to put into a collection of some kind, in order to keep track of connected clients. The documentation I found at http://www.boost.org/doc/libs/1_62_0/doc/html/boost_asio/reference/AcceptHan... Only shows the accept callback with a boost::system::error_code argument. So, my question is, is the example source wrong? and How do I pass my own connection class to the callback? -- View this message in context: http://boost.2283326.n4.nabble.com/boost-asio-asyn-accept-handler-tp4693107.... Sent from the Boost - Users mailing list archive at Nabble.com.