|
Boost Users : |
Subject: Re: [Boost-users] asio::ip::tcp iostream wrong byte count read for last packet
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2014-08-11 22:42:30
On 12/08/2014 02:00, Steve Coleman wrote:
> On 08/10/14 18:50, Gavin Lambert wrote:
>> "read" returns the number of bytes actually read. Use that.
>
> I must be missing something here from your explanation. If I try to
> receive a return from this iostream.read() I get a syntax error.
[...]
> Is there a different object.read() function you are talking about? Or a
> specific data type to declare for the return value type?
My apologies; I was thinking of .read_some() on the socket itself, or
the read() free function. I rarely-to-never use iostreams.
> btw - I want a synchronous read of a binary data stream.
Then I would suggest not using an iostream, and instead using one of the
above. Input streams in particular gloss over quite a bit and in my
opinion it's a terrible idea to use them for binary data, for much the
same reason you wouldn't use scanf.
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