Find out if a host is alive

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Anand Pillai

    Find out if a host is alive

    I would like to add a feature to one of my network programs.
    The requirement is to find out if a server is alive by sending
    it requests. I know of the standard ICMP ping, and searched
    for python modules able to 'PING'. The only hit I got was Jeremy
    Hiltons ping package, written for Python 1.4, and it does not
    work with the latest Python versions (2.0 upwards).

    Are there other ways of finding out (in a few lines of code)
    whether a server is alive, apart from the ICMP protocol?

    Thanks for your help.

    -Anand
  • Alex Martelli

    #2
    Re: Find out if a host is alive

    Anand Pillai wrote:
    [color=blue]
    > I would like to add a feature to one of my network programs.
    > The requirement is to find out if a server is alive by sending
    > it requests. I know of the standard ICMP ping, and searched
    > for python modules able to 'PING'. The only hit I got was Jeremy
    > Hiltons ping package, written for Python 1.4, and it does not
    > work with the latest Python versions (2.0 upwards).[/color]

    http://pynms.sourceforge.net/ does appear to support ICMP, among
    many other things, and to support Python 2.2 (I'd be quite amazed
    if it worked with 2.2 and not with 2.3).
    [color=blue]
    > Are there other ways of finding out (in a few lines of code)
    > whether a server is alive, apart from the ICMP protocol?[/color]

    If you know what services the server is supposed to be running,
    sure. If you have no idea whatsoever, no way. It's quite
    imaginable, for example, that a server does not serve ICMP
    (doesn't WANT to be pinged nor tracerouted etc) but only,
    strictly HTTP on port 80/TCP _period_. If you know that, then
    'pinging' the server is useless as a way to determine whether
    the server 'is alive'; rather, you would try to bind a socket
    to its TCP port 80, and, depending on your definition of "being
    alive", might claim that just managing to bind that socket is
    enough (or, you might try some short HTTP transaction on the
    socket).

    I've noticed an analogy between people wanting their programs
    to check if "a server is alive" and ones wanting their programs
    to check if "a file exists": the question they pose is rarely
    the one they really need to get answered; for example, the
    mere existence of a file is often of no real interest if the
    program does not have permission to _read_ the file -- and
    the mere "aliveness" of a host is often of no real interest
    if the program does not have permission to _talk_ to the host
    along at least one protocol that's of actual _use_...


    Alex

    Comment

    • Anand Pillai

      #3
      Re: Find out if a host is alive

      Thank You Alex. What I want is actually answered by you.
      I would like to find if the server is answering HTTP requests
      at port 80.

      I checked out pyheartbeat, but I think it is useful only for
      computers in the local area network and not the internet.

      -Anand

      Alex Martelli <aleax@aleax.it > wrote in message news:<ccCfb.224 602$R32.7219630 @news2.tin.it>. ..[color=blue]
      > Anand Pillai wrote:
      >[color=green]
      > > I would like to add a feature to one of my network programs.
      > > The requirement is to find out if a server is alive by sending
      > > it requests. I know of the standard ICMP ping, and searched
      > > for python modules able to 'PING'. The only hit I got was Jeremy
      > > Hiltons ping package, written for Python 1.4, and it does not
      > > work with the latest Python versions (2.0 upwards).[/color]
      >
      > http://pynms.sourceforge.net/ does appear to support ICMP, among
      > many other things, and to support Python 2.2 (I'd be quite amazed
      > if it worked with 2.2 and not with 2.3).
      >[color=green]
      > > Are there other ways of finding out (in a few lines of code)
      > > whether a server is alive, apart from the ICMP protocol?[/color]
      >
      > If you know what services the server is supposed to be running,
      > sure. If you have no idea whatsoever, no way. It's quite
      > imaginable, for example, that a server does not serve ICMP
      > (doesn't WANT to be pinged nor tracerouted etc) but only,
      > strictly HTTP on port 80/TCP _period_. If you know that, then
      > 'pinging' the server is useless as a way to determine whether
      > the server 'is alive'; rather, you would try to bind a socket
      > to its TCP port 80, and, depending on your definition of "being
      > alive", might claim that just managing to bind that socket is
      > enough (or, you might try some short HTTP transaction on the
      > socket).
      >
      > I've noticed an analogy between people wanting their programs
      > to check if "a server is alive" and ones wanting their programs
      > to check if "a file exists": the question they pose is rarely
      > the one they really need to get answered; for example, the
      > mere existence of a file is often of no real interest if the
      > program does not have permission to _read_ the file -- and
      > the mere "aliveness" of a host is often of no real interest
      > if the program does not have permission to _talk_ to the host
      > along at least one protocol that's of actual _use_...
      >
      >
      > Alex[/color]

      Comment

      Working...