
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