Boost logo

Boost :

Subject: Re: [boost] Is the async_read more reliable than async_read_some?
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2018-12-08 00:43:22


AMDG

On 12/07/2018 05:05 PM, hh h wrote:
>> aynyc_read is essentially implemented by calling
>> async_read_some repeatedly, until it fills
>> the requested size.
>
> That is exactly the question I am going to ask, if you don't know the
> package size to read, you have to call sync_read_some with
> max_buffer_size, how does the sync_read_some function know the end of
> the message? Obviously, that the end of the message length is smaller
> than the max_buffer_size. Is some timeout defined in sync_read_some to
> identify the end of the message?
>

The way to identify the end of the message
depends on how the end of the message is
represented. If it uses some kind of
delimiter, then async_read_until will
work. If you signal the end of the message
by closing the connection, then you can
just read until EOF (which is indicated
by the error_code).

In Christ,
Steven Watanabe


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