This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate perl
[perl5.git] / lib / Net / Ping / README
index bde09f0..b3665ce 100644 (file)
@@ -1,7 +1,7 @@
 NAME
     Net::Ping - check a remote host for reachability
 
-    $Id: Ping.pm,v 1.16 2002/01/05 23:36:54 rob Exp $
+    $Id: Ping.pm,v 1.1 2002/06/04 00:41:52 rob Exp $
 
 SYNOPSIS
         use Net::Ping;
@@ -32,6 +32,14 @@ SYNOPSIS
         }
         undef($p);
 
+        # High precision syntax (requires Time::HiRes)
+        $p = Net::Ping->new();
+        $p->hires();
+        ($ret, $duration, $ip) = $p->ping($host, 5.5);
+        printf("$host [ip: $ip] is alive (packet return time: %.2f ms)\n", 1000 * $duration)
+          if $ret;
+        $p->close();
+
         # For backward compatibility
         print "$host is alive.\n" if pingecho($host);
 
@@ -94,6 +102,20 @@ DESCRIPTION
         otherwise. The maximum number of data bytes that can be specified is
         1024.
 
+    $p->source_verify( { 0 | 1 } );
+        Allows source endpoint verification to be enabled or disabled. This
+        is useful for those remote destinations with multiples interfaces
+        where the response may not originate from the same endpoint that the
+        original destination endpoint was sent to.
+
+        This is enabled by default.
+
+    $p->hires( { 0 | 1 } );
+        Causes this module to use Time::HiRes module, allowing milliseconds
+        to be returned by subsequent calls to ping().
+
+        This is disabled by default.
+
     $p->bind($local_addr);
         Sets the source address from which pings will be sent. This must be
         the address of one of the interfaces on the local host. $local_addr
@@ -111,20 +133,15 @@ DESCRIPTION
         Ping the remote host and wait for a response. $host can be either
         the hostname or the IP number of the remote host. The optional
         timeout must be greater than 0 seconds and defaults to whatever was
-        specified when the ping object was created. If the hostname cannot
-        be found or there is a problem with the IP number, undef is
-        returned. Otherwise, 1 is returned if the host is reachable and 0 if
-        it is not. For all practical purposes, undef and 0 and can be
-        treated as the same case.
-
-    $p->open($host);
-        When you are using the stream protocol, this call pre-opens the tcp
-        socket. It's only necessary to do this if you want to provide a
-        different timeout when creating the connection, or remove the
-        overhead of establishing the connection from the first ping. If you
-        don't call `open()', the connection is automatically opened the
-        first time `ping()' is called. This call simply does nothing if you
-        are using any protocol other than stream.
+        specified when the ping object was created. Returns a success flag.
+        If the hostname cannot be found or there is a problem with the IP
+        number, the success flag returned will be undef. Otherwise, the
+        success flag will be 1 if the host is reachable and 0 if it is not.
+        For most practical purposes, undef and 0 and can be treated as the
+        same case. In array context, the elapsed time is also returned. The
+        elapsed time value will be a float, as retuned by the
+        Time::HiRes::time() function, if hires() has been previously called,
+        otherwise it is returned as an integer.
 
     $p->open($host);
         When you are using the stream protocol, this call pre-opens the tcp
@@ -184,10 +201,12 @@ NOTES
     ICMP packets.
 
 AUTHORS
-      Current maintainers:
-        colinm@cpan.org (Colin McMillen)
+      Current maintainer:
         bbb@cpan.org (Rob Brown)
 
+      External protocol:
+        colinm@cpan.org (Colin McMillen)
+
       Stream protocol:
         bronson@trestle.com (Scott Bronson)
 
@@ -199,9 +218,9 @@ AUTHORS
         mose@ns.ccsn.edu (Russell Mosemann)
 
 COPYRIGHT
-    Copyright (c) 2001, Colin McMillen. All rights reserved.
+    Copyright (c) 2002, Rob Brown. All rights reserved.
 
-    Copyright (c) 2001, Rob Brown. All rights reserved.
+    Copyright (c) 2001, Colin McMillen. All rights reserved.
 
     This program is free software; you may redistribute it and/or modify it
     under the same terms as Perl itself.