Passing * to member function as parameter

Hello List, I am using boost::asio. My client performs a lot of async read requests and then only responds to those with a write operation. How would I pass a pointer to a member function from the read request to the write handler to call when it performs the write. void handle_read_banner( const boost::system::error_code& error, std::size_t bytes_transferred ) { if(!error) { response_.consume(bytes_transferred); boost::asio::async_write(socket_, request_, boost::bind(&asterisk::handle_write_request, this, boost::asio::placeholders::error //, * to next read handler... )); }else{ throw(boost::system::system_error(error)); } } void handle_write_request( const boost::system::error_code& error //, memfunction func ) { if (!error) { boost::asio::async_read_until(socket_, response_, "\r\n", boost::bind( //&asterisk::handle_read_login_attempt, func this, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)); }else{ throw(boost::system::system_error(error)); } } Thank you, Etienne

How would I pass a pointer to a member function from the read request to the write handler to call when it performs the write. void handle_read_banner( const boost::system::error_code& error, std::size_t bytes_transferred ) { if(!error) { response_.consume(bytes_transferred); boost::asio::async_write(socket_, request_, boost::bind(&asterisk::handle_write_request, this, boost::asio::placeholders::error //, * to next read handler... )); }else{ throw(boost::system::system_error(error)); } }
void handle_write_request( const boost::system::error_code& error //, memfunction func ) { if (!error) { boost::asio::async_read_until(socket_, response_, "\r\n", boost::bind( //&asterisk::handle_read_login_attempt, func this, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)); }else{ throw(boost::system::system_error(error)); } }
Could you mention what line doesn't compile and error you get?
participants (2)
-
Etienne Philip Pretorius
-
Igor R