Catching very specific exceptions
harlinseritt at yahoo.com
Sun Jan 22 16:22:38 EST 2006
Thanks for the effort on this last post, Roy. You asked what I was
hoping to do differently on these two very minutely different error
messages. What I have been trying to do for some time is to write a
ping client (for Win32 platform -- Yes, I develop almost exclusively
for Win32 environment, unfortunately) that would be a bit less buggy
than ones already written, avoid Twisted, and not even involve myself
in pynms (way overkill for what I want and need).
I am finding that with the many quirks (and really bad foundation for
Win32 APIs) that I am having to write a lot of voodoo code so to speak.
If I use a dummy port... let's say port 10001 for example... I can
attempt to connect to a machine at this port. If I get an error that
says "Connection refused", I know that the node is up but is just not
going to allow a connection. On the other hand, if I try to connect to
a node and it's really not up, I'll get a "Connection timed out" error.
In this manner I can really tell if a node is up or not (providing a
TCP/IP stack is installed there). This really what I've wanted. I am
not so concerned whether or not the node pongs back in a certain amount
Yeah normally it's annoying when people ask what you're trying to do
when you ask a specific question, but in this case it's probably
necessary to explain myself before some are willing to help out. I'm
really not interested in even negotiating a successful connection on a
specific port, but this is just a way to tell if something is up or
down (and perhaps the only real way to do it running from a Win32
platform). Thanks for the help. However, if you do have suggestions on
how to get this done better, I am more than glad to hear it!
More information about the Python-list