[zeromq-dev] pub/sub env example not working...

Chuck Remes cremes.devlist at mac.com
Sun Jun 5 21:12:08 CEST 2011


On Jun 5, 2011, at 2:05 PM, Sean Ochoa wrote:

> I'm wondering if someone would be able to take a look at my sample pub/sub example to see what I'm doing wrong.  
> 
> http://paste.pound-python.org/show/7779/
> 
> I've got a publisher sending multipart msgs over the wire, one has the prefix "A" and one "B".  And my subscriber only wants the "B" messages.  As compared to the pubenv/subenv example on the guide, I've combined it into a single script.   Oh, and as a side note, I've been able to run the pubenv/subenv example from the guilde locally in separate scripts. 

You may need a "sleep" between the socket creation steps (bind, connect, setsockopt) and the actual transmission of the messages. The bind & connect operations are asynchronous, so they may not complete by the time you get to the logic that sends all of the messages. In that case, any messages sent through the PUB socket will be *dropped* since a zmq_bind() operation does not create a queue until another socket has successfully connected to it.

As a side note, you don't need to create 2 contexts in this example. Both sockets can be created within the same context. It doesn't hurt, but it also isn't necessary.

cr


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20110605/9232ba8c/attachment.htm>


More information about the zeromq-dev mailing list