[zeromq-dev] blocking send when no peer
Justin Karneges
justin at affinix.com
Tue Jan 31 23:58:31 CET 2012
On Tuesday, January 31, 2012 02:42:48 PM Justin Karneges wrote:
> I'm observing the behavior that when I send to a PUSH socket I've set to
> bind (as opposed to connect), without any peer existing yet, that the send
> call blocks instead of backgrounding.
It seems to be bind-specific. This code hangs, after only printing the first
message:
context = zmq.Context(1)
socket = context.socket(zmq.PUSH)
socket.bind("tcp://127.0.0.1:9100")
print "about to call send"
socket.send("hello")
print "done calling send"
socket.linger = 0
socket.close()
context.term()
However, if I call socket.connect instead of socket.bind, then the code does
not hang.
Is this behavior intentional and/or documented anywhere?
Thanks,
Justin
More information about the zeromq-dev
mailing list