[zeromq-dev] zmq REQ to multiple REP sockets

Pieter Hintjens ph at imatix.com
Tue Feb 8 20:49:48 CET 2011

Hi James,

You would want to use XREQ and XREP sockets, probably, and manage
timeouts using poll. There is a fairly detailed example of an RPC
client and server in C, which can help give a design.

https://github.com/zeromq/zfl/blob/master/src/zfl_rpc.c (client)
https://github.com/zeromq/zfl/blob/master/src/zfl_rpcd.c (server)

This should be documented in Ch4 of the guide at some stage.

Pieter Hintjens

On Tue, Feb 8, 2011 at 8:39 PM, James Bardin <jbardin at bu.edu> wrote:
> Hello,
> I'm getting started with zmq, but I'm stumbling on  the first problem
> I wanted to solve.
> I needed a RPC-like system that could connect to multiple servers, and
> it the docs made it sound really easy.  I would simply connect the
> same REQ socket to each server, and everything would work magically.
> Blocking, and simple round-robin are fine for what I need in this
> situation, but It breaks when one party fails to cooperate.
> I guess my question doesn't need multiple servers; since every send on
> a REQ socket needs to complete a recv from a REP, what do I do when a
> server hangs/disappears/is unavailable? I know how to handle this with
> traditional sockets, but how do I get this to error or timeout with
> zmq? Please point me to TFM if I missed something obvious.
> (I'm best with python , so those are the bindings I'm using BTW, in
> case there are any deficiencies in that library).
> Thanks,
> -jim
> _______________________________________________
> 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