[zeromq-dev] sending and receiving multiple messages and replies from same thread

Pieter Hintjens ph at imatix.com
Wed May 15 15:15:01 CEST 2013


Two answers here. The first is, read the Guide or buy the ZeroMQ book
from O'Reilly, work through the examples, and you'll learn what you
need.

Second answer: what you are trying to do is probably wrong (and this
is very common for people who haven't yet digested how 0MQ works).
Creating one thread per client is a classic BSD socket pattern but not
common for 0MQ apps. You don't explain enough about your use-case to
know what the right direction is.

So I'd really suggest reading the Guide and building enough throw-away
examples to internalize the way it all works. Then, probably a ROUTER
for the server, a DEALER for the clients.

-Pieter





On Wed, May 15, 2013 at 2:14 PM, Hamed Afshar <hamed_afshar at yahoo.com> wrote:
> Hi,
> I want to use zeromq for the following scenario, but can't recognize the
> proper pattern for this.
> Server listens to port 5555. When a client connects to server, thread A
> handles this connection and from now on, every request from client goes to
> thread A, and thread A sends a reply to the client.
>
> Currently, I am using normal req/rep pattern with Router/Dealer on top to
> handle multithreading. but every request from a client is round robined and
> load balanced between thread. What I need, is that when a thread answers the
> first request from a client, from now on, the same thread answer the rest of
> the requests from that client. (like having a persistent connection with
> client).
>
> Is this scenario possible with ZMQ? if yes, how?
>
> Thank you very much for your assistance,
> Jerry
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>



More information about the zeromq-dev mailing list