Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost::asio]Question about how to properly make several async requests (reads and writes)
From: Matheus Araújo Aguiar (matheus.pit_at_[hidden])
Date: 2009-09-04 13:03:25


On Fri, Sep 4, 2009 at 1:45 PM, Rutger ter Borg <rutger_at_[hidden]> wrote:

> Matheus Araújo Aguiar wrote:
>
> > Dear list,
> >
> > I have learned that one cannot make several async write requests, one
> > after another, without waiting for the completion of each request,
> > otherwise the bytes get merged and the messages will not make sense at
> the
> > receiving side. I am correct assuming that, right?
> > My doubt is if the same happens to async read requests. Does one have to
> > wait a read request completes before issuing another? Will the bytes get
> > merged too, if one does not wait before making another read request?
> >
> > Assuming things happen that way, one async request waiting for the
> > completion of another earlier request, then one have serial I/O
> processing
> > and if one wants to have things done in parallel, the simplest way would
> > be having other(s) thread(s) reading and writting in the same I/O object.
> > Is this correct?
> >
> > I hope I have made my doubts clear enough, and if it is not clear please
> > say it and i will try to be more objective.
> >
> > Regards,
>
> Several read/write requests may not make sense because each read/write
> request may be split up in several read_some/write_some requests. Suppose
> you have a larger message A, and a smaller B, and you issue AB, it may be
> transmitted as A1BA2.
>
> In the case of writes, i see the problem. But, in reads, since i'm using
tcp, i think that shouldn't be a problem.

> You can issue a read and write request before completion of either to
> achieve full duplex communication with just one thread.
>
>
Thanks for the tip!

> Kind regards,
>
> Rutger ter Borg
>
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>

-- 
Matheus Araújo Aguiar
Computer Scientist
matheus.pit_at_[hidden]


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