[zeromq-dev] Pub/sub question (0MQ2)

Christian Mannes christ at mannes-tech.com
Fri Nov 6 19:55:35 CET 2009


Hi,

 

I've been trying to get pub/sub to work, and I'm afraid I don't see how I
can publish to more than one listener: I wrote a listener process that does
the following (on windows):

 

    ctx = zmq_init (1, 1, 0);

    s = zmq_socket (ctx, ZMQ_SUB);

    rc = zmq_setsockopt (s, ZMQ_SUBSCRIBE , "*", 1);

    rc = zmq_bind (s, "tcp://127.0.0.1:5555");

 

A sender does this:

 

    ctx = zmq_init (1, 1, 0);

    s = zmq_socket (ctx, ZMQ_PUB);

    rc = zmq_connect (s, "tcp://127.0.0.1:5555");

                // then sends...

 

which works. The problem is that when I run _two_ listeners, only one of
them receives the messages. The other one only gets them after the first one
has exited. This is not the behavior I expect of publish/subscribe: any node
that subscribes to a topic should receive it, right?. Am I doing something
wrong? Do I need to use multicast/pgm (apparently not an option under
Windows)?

 

Cheers,

Christian

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20091106/5fea319f/attachment.htm>


More information about the zeromq-dev mailing list