[zeromq-dev] zeromq3 examples

Brian Smith brian at linuxfood.net
Fri Dec 9 22:41:27 CET 2011


Hi,

I'm going to go out on a limb and assume that your subscriber isn't
getting any messages.

You seem to be mixing the C and C++ API - for starters you may want to try:
subscriber.setsockopt(ZMQ_SUBSCRIBE, "", 0);

I changed the pattern there - the empty string means "match all".

And, when in doubt - add assert() to do error checking you'll know
immediately where it fails, that way.

>From the API docs <http://api.zeromq.org/3-0:zmq-setsockopt>:
An empty option_value of length zero shall subscribe to all incoming
messages. A non-empty option_value shall subscribe to all messages
beginning with the specified prefix. Multiple filters may be attached
to a single ZMQ_SUB socket, in which case a message shall be accepted
if it matches at least one filter.

-B

On Fri, Dec 9, 2011 at 1:33 PM, Tom Fach <tom.fach at yahoo.pl> wrote:
> Hi,
> I try to write a working example with PUB/SUB but based on new ZeroMQ 3. ZGuide probably relates more to ZeroMQ 2. Can somebody help me and point out what is wrong in my code?
>
> best regards,
> Tomasz
>
> _______________________________________________
> 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