Boost logo

Boost Users :

Subject: Re: [Boost-users] Multiple calls to tcp::socket::async_receive fail on Windows
From: Peter Chapman (petechap_at_[hidden])
Date: 2009-08-21 04:52:21


Peter Chapman:

>
> I'm under the impression that queueing several async reads will allow
> the OS to fill one buffer while the read handler for a previous read
> is still executing.
>
> ...
>
> On Linux this technique works fine for multiple pending reads.
> On Windows, it sometimes leads to handlers being called in the wrong order.

Following up my own post for the benefit of the archives:

I was calling tcp::socket::async_receive in quick succession with the buffers A,
B, C, and D in that order.

The buffers were eventually being filled with stream data that, when reassembled
in the order A, B, C, D was correct.

However, the receive handlers were (sometimes) being called out-of-order (e.g.
D, A, B, C).

This is easy enough to work around once you know what's going on (i.e. that the
order of async_receive calls is important, and that the order of their callbacks
is not reliable)

I don't think I could have figured this out from the documentation, hence my
follow-up post here.


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