Boost logo

Boost Users :

Subject: Re: [Boost-users] Asio problems with async_read
From: Allan Nielsen (a_at_[hidden])
Date: 2011-08-08 08:54:52


Hi

Here is how I call the function

I have splitted it in two like this, because the protocol specifies a
timeout pr. character and not pr. message

std::vector<uint8_t> receive(boost::asio::io_service & io,
boost::asio::serial_port & cctalk_port, size_t size){
     std::vector<uint8_t> v;
     size_t i = 0;

     while( i < size ) {
         std::vector<uint8_t> _v = receive(io, cctalk_port);
         copy(_v.begin(), _v.end(), std::back_inserter(v));
         i += _v.size();
         cout << "Received: " << v.size() << "/" << size << endl;
     }

     return v;
 }

On Mon, Aug 8, 2011 at 2:32 PM, Igor R <boost.lists_at_[hidden]> wrote:
>>    boost::asio::async_read(
>>            cctalk_port,
>>            result,
>>            boost::asio::transfer_at_least(1),
>>            boost::bind( &set_result, &read_result, _1 ));
>
>
> The above call promises you to read 1 byte.
> After it completes, where do you start another one?
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


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