[zeromq-dev] I'm stuck: How to handle multiple clients, single server?

Pieter Hintjens ph at imatix.com
Tue Aug 31 10:59:38 CEST 2010


You can use REQ sockets at the client and XREP sockets at the server,
yes.  Note that when you receive the message via an XREP socket, 0MQ
will provide you a multipart message where the first part is the
identity of the original client, second part is empty, third part is
the actual request data.  You must reply back to the XREP socket with
the same structure of message, and 0MQ then uses that identity (first
part) to route the response back to the client.

See the description of ZMQ_XREP here: http://api.zeromq.org/zmq_socket.html

-Pieter

On Tue, Aug 31, 2010 at 2:18 AM, Naveen Chawla <naveen.chwl at gmail.com> wrote:
> Ok to answer my own question, do I simply use REQ sockets for the
> clients, and a XREP socket for the server? Does this automatically
> route replies exclusively to the originator? Even though it's all on
> the same communication channel?
>
> On 31 August 2010 01:05, Naveen Chawla <naveen.chwl at gmail.com> wrote:
>> This isn't for the existing pub-sub model, but the other way round.
>>
>> I want to poll one server, potentially by multiple clients, for
>> various different things.
>>
>> What is the optimal way of getting responses back to the right client
>> that made the request?
>>
>> I wish 0mq had an optimal pub-sub "pull" model, but it does not.
>>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>



-- 
-
Pieter Hintjens
iMatix - www.imatix.com



More information about the zeromq-dev mailing list