Ahh, i think that might be close to what i was looking for. Thanks a lot! Is there any tutorial/example on similar lines (reactor/proactor) ? Rgds Arun
On Mon, Mar 15, 2010 at 5:23 PM, Martin Sustrik <[email protected]> wrote: > Arun, > > > I didnt really mean the API differences (which as you point out, >> differ only by a loop). However, as i explained, i have to use this same >> socket for sending too. Then the code becomes queue<msg_t> outgoing queue; >> void recv_thread_routine () >> { >> socket_t s (ctx, ZMQ_SUB); >> s.connect (...); >> while (true) { >> message_t msg; >> s.recv (&msg); >> callback (msg); >> acquire lock on outgoingqueue then if (outgoingQueue not empty) >> dequeue and send contents() >> } >> } >> >> Is this the only design possible? >> > > The above won't work. You can't send messages to SUB socket. > > However, if you have a bi-directional socket (such as P2P), you can poll > for IN & OUT and do the send/recv depending on the result. > > Martin >
_______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
