boost::asio::async_read_until composite completion condition

Hello List, I need to implement a completion condition for boost::asio::async_read_until where either a boost::regex is matched or boost::asio::transfer_at_least is matched. Any suggestions will be much appreciated. Kindly, Etienne

I need to implement a completion condition for boost::asio::async_read_until where either a boost::regex is matched or boost::asio::transfer_at_least is matched.
With this overload: http://www.boost.org/doc/libs/1_39_0/doc/html/boost_asio/reference/async_rea... ...you can implement any condition you wish.

Igor R wrote:
I need to implement a completion condition for boost::asio::async_read_until where either a boost::regex is matched or boost::asio::transfer_at_least is matched.
With this overload: http://www.boost.org/doc/libs/1_39_0/doc/html/boost_asio/reference/async_rea... ...you can implement any condition you wish. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Thank you. Etienne

With this overload: http://www.boost.org/doc/libs/1_39_0/doc/html/boost_asio/reference/async_rea... ...you can implement any condition you wish.
Hello List, I get a compiling error: error: no matching function for call to 'async_read_until(boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >&, boost::asio::streambuf&, <unresolved overloaded function type>, boost::_bi::bind_t<void, boost::_mfi::mf2<void, xmpp::client, const boost::system::error_code&, unsigned int>, boost::_bi::list3<boost::_bi::value<xmpp::client*>, boost::arg<1> (*)(), boost::arg<2> (*)()> >)' When I have the following: boost::asio::async_read_until( socket_, streambuf_, read_condition, boost::bind( &client::handle_read, this, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred ) ); And typedef boost::asio::buffers_iterator< boost::asio::streambuf::const_buffers_type> iterator; std::pair< iterator, bool
read_condition( iterator begin, iterator end ) { boost::asio::ip::tcp::socket::receive_buffer_size option; socket_.get_option(option); if((end - begin) >= option.value()) { return std::make_pair(end,true); } while(begin != end) { if(*begin++ == '>') { return std::make_pair(begin,true); } } return std::make_pair(end,false); }
So why am I getting <unresolved overloaded function type>? Regards, Etienne

Never mind, got it working finally. I was using a class member function and not a free function. Etienne
participants (2)
-
Etienne Philip Pretorius
-
Igor R