Boost logo

Boost Users :

Subject: Re: [Boost-users] boost concurrent write/read
From: Rutger ter Borg (rutger_at_[hidden])
Date: 2011-03-09 05:42:41


On 03/09/2011 11:22 AM, Marco Piacentini wrote:
> Hi guys...a simple question..
> what happen if there are concurrent write/write(for example
> async_write_some) or write/read(for example async_write_some and
> async_read_some) operation on the same socket?I have handle this problem
> or it is automatically handled by boost functions?
> And if I have to send a lot of data, to avoid congestion problem, I need
> a buffer?
>
> thank you...
>

You have to make sure that no concurrent calls can occur to member
functions of the same socket class. This may be achieved by serializing
your read/writes/read handlers/write handlers through a strand.

In case of large buffers, Asio may split up an async_write() operation
into several async_write_some operations (often referred to as "composed
operations").

HtH,
Cheers,

Rutger


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