|
Boost Users : |
Subject: [Boost-users] [asio] How to deal with no-connect and/or read-timeout
From: Michael Powell (mwpowellhtx_at_[hidden])
Date: 2013-06-24 18:22:33
Hello,
I posted previously, but this is a bit of a follow-on thought.
Did some searching, and SO has this note:
http://stackoverflow.com/questions/13126776/asioread-with-timeout
Pardon me while I stare in disbelief. Seriously? Okay, I'd like to use
Boost.Asio to facilitate things. Is this the way (one proposed way) of
handling read-with-timeout?
Our scenario goes similar to this I think:
* Client may (or may not) connect, depending on the integration
scenario. The main service thread should tolerate either, with
plausibly the socket connection/session operating in another thread
"asynchronously".
* When client connects, the session logic is pretty straightforward:
read if/when there is something to read, and pass it through a message
framing unwrapper. Completed message gets deserialized and published
into a thread-safe queue.
* Events may be generated from the main service thread and
subsequently published to the client: effectively a write operation,
after passing a serialized message through a message framing wrapper.
Doable? Feasible, possibly with some sort of a
ping-ponging-back-and-forth type of session handling callback
mechanism? I am cautiously optimistic that this has more to do with
connection/session callback/state-machine type things, than it does
Asio?
Regards,
Michael
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