Re: Catching very specific exceptions
- From: Roy Smith <roy@xxxxxxxxx>
- Date: Sun, 22 Jan 2006 17:17:01 -0500
"Harlin Seritt" <harlinseritt@xxxxxxxxx> wrote:
> 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.
Yeah, tell me about it. My current project at work is porting our IPv6
management package (including ICMP ping) to windows; "many quirks" would be
a good way to describe it!
> 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.
Maybe. It could be that some firewall between you and the target is
blocking things. Depending on how the firewall is programmed, this may
show up as a timeout or as a connection refused (although the former would
be more common).
It's also not always a clear-cut question what "up" means. Some operating
systems can get into modes where for all intents and purposes they've
crashed, but they're still answering pings and/or actively refusing
connections.
The traditional way to tell if a node is up is to send it an ICMP echo
request, rather than trying to connect to a TCP port. You might want to
look into using that instead of trying to connect to random ports. Not
that that ICMP doesn't have its own problems :-)
.
- Follow-Ups:
- Re: Catching very specific exceptions
- From: Harlin Seritt
- Re: Catching very specific exceptions
- References:
- Catching very specific exceptions
- From: Harlin Seritt
- Re: Catching very specific exceptions
- From: Alex Martelli
- Re: Catching very specific exceptions
- From: Roy Smith
- Re: Catching very specific exceptions
- From: Harlin Seritt
- Catching very specific exceptions
- Prev by Date: Re: OT: excellent book on information theory
- Next by Date: Re: New Python.org website ?
- Previous by thread: Re: Catching very specific exceptions
- Next by thread: Re: Catching very specific exceptions
- Index(es):
Relevant Pages
|