Boost logo

Boost Users :

Subject: [Boost-users] Using boost::asio
From: Ram Sundar (bhosundar_at_[hidden])
Date: 2011-06-02 12:26:41


Hi,
    I am trying to use boost::asio for a project where we currently use ACE.
The way it currently works, the data that is passed between the server and
client is preceded by a header with the data length. Currently with ACE when
data is ready to be read at the socket, the handler function is invoked, and
we invoke a ioctl with FIONREAD to read the number of bytes ready to be read
and then allocate a buffer of that length to read the data. The reason we do
this way is because the data may be sent in chunks. Internally we keep track
of how much data we have received etc. I am at a loss to know how to do this
using boost::asio. All the read methods expect a buffer where data will be
read and it also needs the size of the buffer. Is there a way we get
notified when data is ready to be read, and do similar operation. ie read
the number of bytes available to read and then allocate buffers to read the
data? Are there any other methods to accomplish the same?

Thanks,
Ram



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