[zeromq-dev] Socket.connect doesn't raise any error

Pazzo Da Legare pazzodalegare at gmail.com
Tue Mar 6 10:37:36 CET 2012


Dear all,

I'm playing with zmq binding for python, with PUSH/PULL socket.
How can I get an error if connect fails?

I try to connect to "nothing": I tried both and unreachable/reachable
address but with no zmq PULL receiving on it.

----snip----
import zmq

context = zmq.Context()
socket = context.socket(zmq.PUSH)

try:
    socket.connect("tcp://159.214.12.12:23666")
except:
    import sys
    print "ERROR"
    sys.exit(-1)

while True:
    socket.send("aaaaaa")
    print "try to send..."
----snip----

How can I:

- know if socket is connected?
- limit the length of buffered messages?



More information about the zeromq-dev mailing list