Boost::Asio No write handler called after async_write
Hi everyone, this (I think) is about boost::asio. Could somebody please tell
me why in the following code my handle_write function is never called after
the async_write? This tries to be an hybrid mixture of sync read and async
write through a socket and even though the string gets written, no handler
is called at the end.
#include
Hi everyone, this (I think) is about boost::asio. Could somebody please tell me why in the following code my handle_write function is never called after the async_write?
You never call io_service::run(), that's why no handler is invoked.
Thanks for the answer, but all examples I see in the documentation using
io_service:::run() are using an async-read/async-write model. How would
io_service::run() fit in my sync-read/async-write model? Or is it impossible
to do async-write if using async-read?
On Tue, Apr 14, 2009 at 3:51 AM, Igor R
Hi everyone, this (I think) is about boost::asio. Could somebody please tell me why in the following code my handle_write function is never called after the async_write?
You never call io_service::run(), that's why no handler is invoked. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Thanks for the answer, but all examples I see in the documentation using io_service:::run() are using an async-read/async-write model. How would io_service::run() fit in my sync-read/async-write model? Or is it impossible to do async-write if using async-read?
I don't see in your code snippet where you intend to perform sync.read. Anyway, there's no technical limitation to use both sync.read and async.write - for example, you can call sync.read in handle_write, and it will work. As for io_service::run, you can place it just before "return" in Server::run.
Thanks! Working like a charm now.
David E. Narváez
On Tue, Apr 14, 2009 at 11:15 AM, Igor R
Thanks for the answer, but all examples I see in the documentation using io_service:::run() are using an async-read/async-write model. How would io_service::run() fit in my sync-read/async-write model? Or is it impossible to do async-write if using async-read?
I don't see in your code snippet where you intend to perform sync.read. Anyway, there's no technical limitation to use both sync.read and async.write - for example, you can call sync.read in handle_write, and it will work. As for io_service::run, you can place it just before "return" in Server::run. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
David Narvaez
-
Igor R