in reply to Re: Re: ping problem
in thread ping problem

Granted, according to the docs, my snippet will say $host is alive if it accepts connections on port 80. This might or might not mean that a webserver is running, just that something is listening there, or - more precisely - that a successful connection was made (three way handshake completed).

robartes reads some docs...

Ah, that's what the syn 'protocol' is. The Perl 5.8.0 version of Net::Ping (whose docs I consulted) does not have this yet. If I understand correctly, for just testing one host, using syn is over the top, tcp does all of that in one call. If you are pinging various hosts, using a bunch of syn's and then using the ack method to listen for the returning ACK packets (if any) will be the way to go, as stated in the docs.

robartes reads some more docs...

Double ah. So the darn thing answers true if it gets a RST as well. xmath, you are fully correct in your reply to my comment.

Thanks for the heads up, xmath.

Update:: the confusion seems to stem from using different version of Net::Ping. My post assumes the version bundled with Perl 5.8.0, xmath is working off of version 2.28 of Net::Ping, which indeed shows the behaviour he comments on.

CU
Robartes-

Replies are listed 'Best First'.
Re: Re: Re: Re: ping problem
by xmath (Hermit) on Mar 04, 2003 at 13:54 UTC
    Granted, according to the docs, my snippet will say $host is alive if it accepts connections on port 80. This might or might not mean that a webserver is running, just that something is listening there

    No, that's the problem, it even says $host is alive if nothing is listening there and the connection is refused (because Net::Ping concludes that the host is up to be able to refuse the connection). It only says $host is dead if it gets no reply whatsoever or an icmp unreachable or so.

    •Update: oops, I missed the second part before I replied..

    Double ah. So the darn thing answers true if it gets a RST as well.

    Yes, exactly :-)