[zeromq-dev] How to detect if a remote socket has closed
Pieter Hintjens
ph at imatix.com
Tue Aug 17 18:04:59 CEST 2010
On Tue, Aug 17, 2010 at 5:04 PM, <David.Briant at ubs.com> wrote:
> 1) Can I check that all socket types are meant to rebind automatically.
All except ZMQ_PAIR, which you should not be using in normal code anyhow.
> 2) Also the REQ socket appears to cause python to use 100% cpu if the
> REP socket isn't running. I assume that shouldn't be the case?
Definitely not healthy. So I just booted Windows XP and tried the
Hello World client and server from the guide, in Python. Started the
hwclient.py, watched CPU. Killed it, then started hwserver.py. In
neither case was there any CPU usage (task manager itself takes 1% or
so).
> So it looks like I should have a directory service that can mediate PAIR
> connections between peers, I need a SUB connection to the directory and
> a REQ connection to initially connect to it on a well known port. The
> directory a service is registered with PUBs any state changes such as
> service crashes. It will also PUB a restart (of itself) on the same
> channel. The only situation I don't have covered is if a directory crash
> means the directory starting on a different IP but a slow heartbeat
> mechanism should sort that.
>
> Do you recommend PGM for the PUB/SUB part? - initially there'll only be
> a few apps so TCP might be fine.
Don't take this the wrong way, but I'd really suggest you read through
the user guide chapters 1 and 2 and work through all the examples
until they are clear. They're all simple C programs.
Then, start by solving a small part of your problem and get that
working. Then, extend that carefully one piece at a time.
-
Pieter Hintjens
iMatix - www.imatix.com
More information about the zeromq-dev
mailing list