[zeromq-dev] Why socket.send will block without consumer

He Jie Xu soulxu at gmail.com
Wed Mar 20 05:14:09 CET 2013

Hi, all

I try zeromq with following code:

import zmq
import random
import time

context = zmq.Context()
socket = context.socket(zmq.PUSH)
socket.setsockopt(zmq.HWM, 1000)
while True:
    zipcode = random.randrange(1, 100000)
    temperature = random.randrange(1, 215)
    message = "%d %d" % (zipcode, temperature)
    print 'send', message

When I am running the code without any consumer. it will block at

But after I read the document, I think when I set HWM, the message will
send to memory buffer, it shouldn't block. Is there any wrong? How can I
make the 'socket.send' won't block?

my zmq version was 2.1.11

I will appreciate any help from you!

Thanks you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20130320/8d381db4/attachment.htm>

More information about the zeromq-dev mailing list