Hi,
I have multiple PUB sockets and single SUB socket. The PUBs perform
connect() and the SUB performs bind().
The problem I see is that if the SUB starts after the PUBs, it still
receive all the messages sent before. This seems to contradict to what
the documentation said.
However, if I have only one PUB and one SUB, and I reverse the
connect/bind by having PUB bind() and SUB connect(), I get the
documented behavior in which SUB doesn't receive historical messages.
Here are the code:
SUB
-------
import zmq
context = zmq.Context()
sub = context.socket(zmq.SUB)
sub.setsockopt(zmq.SUBSCRIBE, "")
sub.bind("tcp://127.0.0.1:27888")
while(1):
msg = sub.recv()
print msg
PUB
-------
import zmq, time
from datetime import datetime
context = zmq.Context()
pub = context.socket(zmq.PUB)
pub.connect("tcp://127.0.0.1:27888")
while(1):
msg = datetime.now().strftime('%H:%M:%S.%f')
print msg
pub.send(msg)
time.sleep(1)
Regards,
Jia
===============================================================================
Please access the attached hyperlink for an important electronic communications
disclaimer:
http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
===============================================================================
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev