[zeromq-dev] Pub/Sub multi sockets & PGM

Olivier olivier.chamoux at fr.thalesgroup.com
Wed Feb 3 08:16:51 CET 2010


Hi everybody,

I'm using the pub/sub model with pgm. And in my subscriber, i need to
manage the messages received in different way, depending on their
topics.
So, instead of using one socket with multiple filtering like :

s.setsockopt (ZMQ_SUBSCRIBE, "x.",2 );
s.setsockopt (ZMQ_SUBSCRIBE, "y.",2 );

I try to open one socket per topic :

zmq::context_t ctx ( number_of_topic, 1);

(thread 1)
zmq::socket_t s1 (*ctx, ZMQ_SUB)
s1.connect ("pgm://eth0;224.0.0.1:5555");
s1.setsockopt (ZMQ_SUBSCRIBE, "x.",2);

(thread 2)
zmq::socket_t s2 (*ctx, ZMQ_SUB)
s2.connect ("pgm://eth0;224.0.0.1:5555");
s2.setsockopt (ZMQ_SUBSCRIBE, "y.",2);

But, by doing this, i got this error :

Pgm-CRITICAL **: pgm_init: assertion `pgm_got_initialized == FALSE'
failed
terminate called after throwing an instance of 'zmq::error_t'
what():  Invalid argument
Abandon


With one topic it works fine, but with two or more, this error appears.
What am i doing wrong ? Any idea ?



Regards,
Olivier.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sub.cpp
Type: text/x-c++src
Size: 1359 bytes
Desc: not available
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20100203/55ef6ae9/attachment.cpp>


More information about the zeromq-dev mailing list