Boost logo

Boost Users :

Subject: [Boost-users] [asio] serial_port::async_read_some() and scalable buffers
From: Robert Dailey (rcdailey_at_[hidden])
Date: 2009-08-27 15:16:09


Hello,

I have a std::vector of bytes that I am passing into
boost::asio::buffer(). The vector originally is of size 0. Basically,
I want the vector to be resized by asio depending on how much data is
read in. I don't want to choose an arbitrary upper-limit for the
buffer. Is this possible?

Below is an example of what I am doing:

  std::vector<boost::uint8_t> stream;
  m_port.async_read_some(
    boost::asio::buffer( stream ),
    boost::bind( &SerialClient::ReadCompleted, this, stream, error,
bytes_transferred )
    );

However, the above code will never read any data because my vector is
0 and it expects it to have a size.

---------
Robert Dailey


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