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?
_______________________________________________
zeromq-dev mailing list
zerom...@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev
Dear all,
I'm playing with zmq binding for python, with PUSH/PULL socket.
How can I get an error if connect fails?
- limit the length of buffered messages?
Thank you for answer.
2012/3/6 Ian Barber <ian.b...@gmail.com>:
>> I'm playing with zmq binding for python, with PUSH/PULL socket.
>> How can I get an error if connect fails?
>
>
> ZeroMQ will just retry the connection for you, so you don't get a message if
> the connection is still pending.
Can I setup how long ZeroMQ have to retry?
>> - limit the length of buffered messages?
>
>
> Look for the HWM socket options - they let you set a limit. Note that the
> limit is not really precise - things can be pushed into the TCP buffer, so
> your effective limit is likely to be TCP buffer size + HWM number of
> messages.
I will give a look at HWM parameters, thanks again,
pz
> Ian
> Dear Ian,
>
> Thank you for answer.
>
> 2012/3/6 Ian Barber <ian.b...@gmail.com>:
>>> I'm playing with zmq binding for python, with PUSH/PULL socket.
>>> How can I get an error if connect fails?
>>
>>
>> ZeroMQ will just retry the connection for you, so you don't get a message if
>> the connection is still pending.
>
> Can I setup how long ZeroMQ have to retry?
No. Please read the documentation, man pages and the FAQ. By at least reading the man pages, you'll see there is no support for this kind of timeout mechanism.
These docs can be found here:
guide: http://zguide.zeromq.org/page:all
man pages: http://api.zeromq.org/
faq: http://www.zeromq.org/area:faq
Thank you for your answer. I solved the problem at application level.
pazzodalegare
2012/3/6 Chuck Remes <cremes....@mac.com>: