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