[zeromq-dev] Highwater marks in PUSH/PULL scenarios

Nick Howden nahowden at qinetiq.com
Thu May 5 17:42:50 CEST 2011


Should I be able to set a HWM on a PULL client?

With the following test code, as soon as the client connects to the server all
of the remaining messages are delivered. 
Start server 
1
2
3
...
100
[blocks at 100 as expected]


Start Client, 
Client ticks at one read every 1/20th second

But the server immediately sends the rest of the messages



Server.py

import zmq
context = zmq.Context()
socket = context.socket(zmq.PUSH)
socket.setsockopt(zmq.HWM, 100)
socket.connect("tcp://10.0.10.0:5051")
for i in range(1, 1000):
    socket.send('')
    print i



Client.py

import zmq, time
context = zmq.Context()
socket = context.socket(zmq.PULL)
socket.setsockopt(zmq.HWM, 100)
socket.bind("tcp://10.0.10.0:5051")
for i in xrange(10000):
    print i
    a = socket.recv()
    time.sleep(0.05)








More information about the zeromq-dev mailing list