Yes, you will need separate buffers for read and write. Even without
multi-threading, since it's entirely possible to have an async_read in
progress at the same time as an async_write on the same socket.
For multiple threads, host a
`asio::strandasio::io_context::executor_type` in each io object (server,
connection, client).
Bind all the class's handlers to that strand (see my example above). The
strand behaves like an extremely efficient mutex, with respect to handler
invocation, for your object.
On Mon, 7 Jan 2019 at 17:11, hh h via Boost
I currently use a fixed size of array char buffer[MAX_SIZE] as a life time buffer attached to the class running on async_read, I think that was your point it should live as long as the socket lives. I think it should be fine for running a single thread, for multiple threads it might cause issues.
Anyway, I am going to run a single thread, to use two static life time buffers, one for async_read, one for async_write.
Thanks Richard.
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
-- Richard Hodges hodges.r@gmail.com office: +442032898513 home: +376841522 mobile: +376380212 (this will be *expensive* outside Andorra!) skype: madmongo facebook: hodges.r