Subject: Re: [boost] [asio] Order of asynchronous messages
From: Gavin Lambert (boost_at_[hidden])
Date: 2018-10-01 22:56:26
On 2/10/2018 04:23, Florian Lindner wrote:
> Now we are having problems with mangled data that are unexplainable right now.
> - Is the order of requests guaranteed to be preserved? I think so, based that asio works on TCP.
> - What happens if there is another read or write performed on the socket. I think that there is no way to guarantee that this does not interfere with the order of the asynchronous send or queued requests.
There is no guarantee about transmission order for interleaved writes.
Don't do it.
In general, you should have at maximum one read and one write operation
"in flight" at any given moment for any given stream socket, if you
expect the stream to be coherent.
(Also, avoid mixing read with read_until. There is a way to do this
correctly but it's non-intuitive.)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk