Boost logo

Boost Users :

From: Eugene M. Kim (gene_at_[hidden])
Date: 2008-02-26 20:20:24


Derrick Hathaway wrote:
> Could someone please shed some light on ASIO SSL reads and writes for
> me? The names of the read and write functions for the ssl::stream
> (read_some and write_some) imply to me that the buffer(s) may not be
> completely filled/sent with a read/write. Do I need to have some
> intermediate handler that will begin another async_read/write_some
> until my buffer is filled/flushed? The documentation doesn't seem to
> indicate that this is necessary. It makes sense from the example that
> the reads may not fill the provided buffer before invoking the
> handler. So it may be necessary to call read_some multiple times until
> the expected number of bytes is received. But is this also the case
> with writes, and if so, how do I manage multiple writes if I provide a
> vector of buffers to be written with and async_write_some?
I have no authority to give a definite answer, but my experience with it
indicates that what you assume is indeed right. All
read_some/write_some methods may read or write fewer bytes than
requested, and you need to check the num_transferred placeholder and
invoke read_some/write_some again as necessary.

I remember seeing an adapter method that does this for you in some other
class, but I forgot exactly where it is (didn't need/want to use it in
my program).

Cheers,
Eugene




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