|
Boost Users : |
Subject: Re: [Boost-users] boost concurrent write/read
From: Marco Piacentini (marcopiacenta_at_[hidden])
Date: 2011-03-09 06:14:10
I have a simple TCP multiprocess server...inside each child server(each of one
handles distincted connection), I call a list of operation...suppose the
following:
socket.async_read_some(....); //receive a client request
socket.async_write_some(...); //respond to client request
socket.async_write_some(...); //independently of the client request, send
something to the client
Have I use strand,or this situation doesn't cause problems?
I don't use thread...
thanks!!!
________________________________
Da: Rutger ter Borg <rutger_at_[hidden]>
A: boost-users_at_[hidden]
Inviato: Mer 9 marzo 2011, 11:42:41
Oggetto: Re: [Boost-users] boost concurrent write/read
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 mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
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