Boost logo

Boost :

Subject: [boost] Is the async_read more reliable than async_read_some?
From: hh h (jupiter.hce_at_[hidden])
Date: 2018-12-07 09:44:38


Hi,

I have been using asio::async_read with protobuf for some time, it is
relative easy to use protobuf function SerializeToOstream to attach a
packet header and send the packet header along with to protobuf
message, with fixed packet header size and message size in the header,
I was able to use async_read.

But I have to change to use msgpack which I could not find a way like
protobuf to attach a packet header to msgpack message. The only way I
could do is to use async_read_some, but I am very concerning the
remark in the async_read_some document. Appreciate your comments.

"The read operation may not read all of the requested number of bytes.
Consider using the async_read function if you need to ensure that the
requested amount of data is read before the asynchronous operation
completes."

Thank you.

- JH


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk