" every write must be followed by a read before another write is performed."
I won't assume for the moment that this is exactly what you need. If it is, disregard my reply. Another option is to simply use an agent to send data, and register callbacks in an atom. Each sent message gets an ID (auto incrementing long). O0n the response, the remote end sends back that id. Something like "ACK:42". The reader on the local end looks in the atom for a callback with that ID and dispatches it. So one thread for reading, one for writing, and an atom to track IDs and callbacks. You could configure this a dozen ways (perhaps using locks instead of callbacks). Your throughput will be much higher with this sort of approach as messages can be interleaved, if you send one message that takes 10 seconds to get a reply it won't hang the entire connection for that time. Async is the way to go. And all this interops very cleanly with core.async. But if you can't do it this way (for example you don't control the remote end) then just lock the entire connection and deal with the problems that arise from that approach. Timothy On Tue, Jun 3, 2014 at 8:50 AM, Joachim De Beule <joachim.de.be...@gmail.com > wrote: > That's indeed what I needed! Thanks!! > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- “One of the main causes of the fall of the Roman Empire was that–lacking zero–they had no way to indicate successful termination of their C programs.” (Robert Firth) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.