Guido Winkelmann
2011-10-07 13:53:32 UTC
Hi,
I'm in need of some clarification regarding the documentation to the fourth
overload of async_read - this one:
template<
typename AsyncReadStream,
typename Allocator,
typename CompletionCondition,
typename ReadHandler>
void async_read(
AsyncReadStream & s,
basic_streambuf< Allocator > & b,
CompletionCondition completion_condition,
ReadHandler handler);
The documentation gives the required signature of CompletionCondition as this:
std::size_t completion_condition(
// Result of latest async_read_some operation.
const boost::system::error_code& error,
// Number of bytes transferred so far.
std::size_t bytes_transferred
);
Question: When async_read calls completion_condition, will bytes_transferred
include the number of bytes that were already in the read buffer b before the
call to async_read, or will it only include the number of bytes actually
transferred from the socket to buffer since the last call to async_read?
If it's the latter, that would at least explain the problems I've been having
that I described in the earlier thread "Weird effect when reading more than
1000 bytes with async_read".
Regards,
Guido
I'm in need of some clarification regarding the documentation to the fourth
overload of async_read - this one:
template<
typename AsyncReadStream,
typename Allocator,
typename CompletionCondition,
typename ReadHandler>
void async_read(
AsyncReadStream & s,
basic_streambuf< Allocator > & b,
CompletionCondition completion_condition,
ReadHandler handler);
The documentation gives the required signature of CompletionCondition as this:
std::size_t completion_condition(
// Result of latest async_read_some operation.
const boost::system::error_code& error,
// Number of bytes transferred so far.
std::size_t bytes_transferred
);
Question: When async_read calls completion_condition, will bytes_transferred
include the number of bytes that were already in the read buffer b before the
call to async_read, or will it only include the number of bytes actually
transferred from the socket to buffer since the last call to async_read?
If it's the latter, that would at least explain the problems I've been having
that I described in the earlier thread "Weird effect when reading more than
1000 bytes with async_read".
Regards,
Guido