[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.bind("ipc://test.sock")
socket.setsockopt(zmq.HWM, 1000)
while True:
    zipcode = random.randrange(1, 100000)
    temperature = random.randrange(1, 215)
    message = "%d %d" % (zipcode, temperature)
    socket.send(message)
    print 'send', message
    time.sleep(1)


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

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