[zeromq-dev] zmq REQ to multiple REP sockets

James Bardin jbardin at bu.edu
Wed Feb 9 04:53:13 CET 2011

On Tue, Feb 8, 2011 at 7:19 PM, Chuck Remes <cremes.devlist at mac.com> wrote:

> Since the library does not support timeouts on REQ/REP sockets, then it isn't overkill. It's the only way available to solve your problem.

I'm starting to see that. I'm finding more examples in github, which
are helping to clarify things.

> The python bindings should support zmq_poll(). As far as I know, those bindings support every facet of the 0mq library.

Yes, it was just the amount of code, plus the zfl that confused me,
and being slow in c, it seemed a little daunting.

> No matter how you look at it, at some point you will have to poll on the socket and implement your own timeout. The library does not have this built in yet.
> In the case you mention above, zmq_connect() is an asynchronous operation. Unless it returns a non-0 value (which means it failed immediately), it will retry the connect in the background. Are you checking the return code from your calls to zmq_connect()?
> I think you are confused about the fundamentals of 0mq. It's unfortunate that they are called "sockets" because people new to the library always try to use them *exactly* the same as they would a posix socket. 0mq sockets have different semantics and require a different way of approaching and solving problems.

I was counting on needing zmq_poll, but you are right, and I'm still
coming to terms with the fundamentals here. I think stems from the
claims that zmq > "raw sockets", so it seems it should handle
everything I could do before, plus more.

A timeout of some sort would be great (by the sound of it, it's
planned?), at least in the higher level libraries where a lot pieces
are hidden. As a newcomer using python, what I ran into immediately
was a blocking call to recv, with no obvious way to program around it
when it blocks indefinitely, and as a defensive programmer, I always
count on that happening.


More information about the zeromq-dev mailing list