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

Min miniway at gmail.com
Wed Mar 20 06:39:58 CET 2013


Hi,

The HWM is a maximum buffer length (not actually identical).

For PUSH, send will block if it reach the HWM.

Thanks
Min

On Wednesday, March 20, 2013, He Jie Xu wrote:

> 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/08da31d0/attachment.htm>


More information about the zeromq-dev mailing list