7 use vars qw(@ISA @EXPORT $VERSION
8 $def_timeout $def_proto $def_factor
9 $max_datasize $pingstring $hires $source_verify $syn_forking);
10 use Fcntl qw( F_GETFL F_SETFL O_NONBLOCK );
11 use Socket qw( SOCK_DGRAM SOCK_STREAM SOCK_RAW PF_INET SOL_SOCKET
12 inet_aton inet_ntoa sockaddr_in );
13 use POSIX qw( ECONNREFUSED ECONNRESET EINPROGRESS EAGAIN WNOHANG );
18 @EXPORT = qw(pingecho);
23 $def_timeout = 5; # Default timeout to wait for a reply
24 $def_proto = "tcp"; # Default protocol to use for pinging
25 $def_factor = 1.2; # Default exponential backoff rate.
26 $max_datasize = 1024; # Maximum data bytes in a packet
27 # The data we exchange with the server for the stream protocol
28 $pingstring = "pingschwingping!\n";
29 $source_verify = 1; # Default is to verify source endpoint
32 if ($^O =~ /Win32/i) {
33 # Hack to avoid this Win32 spewage:
34 # Your vendor has not defined POSIX macro ECONNREFUSED
35 *ECONNREFUSED = sub {10061;}; # "Unknown Error" Special Win32 Response?
40 # require "asm/socket.ph";
41 sub SO_BINDTODEVICE {25;}
43 # Description: The pingecho() subroutine is provided for backward
44 # compatibility with the original Net::Ping. It accepts a host
45 # name/IP and an optional timeout in seconds. Create a tcp ping
46 # object and try pinging the host. The result of the ping is returned.
50 my ($host, # Name or IP number of host to ping
51 $timeout # Optional timeout in seconds
53 my ($p); # A ping object
55 $p = Net::Ping->new("tcp", $timeout);
56 $p->ping($host); # Going out of scope closes the connection
59 # Description: The new() method creates a new ping object. Optional
60 # parameters may be specified for the protocol to use, the timeout in
61 # seconds and the size in bytes of additional data which should be
62 # included in the packet.
63 # After the optional parameters are checked, the data is constructed
64 # and a socket is opened if appropriate. The object is returned.
69 $proto, # Optional protocol to use for pinging
70 $timeout, # Optional timeout in seconds
71 $data_size, # Optional additional bytes of data
72 $device, # Optional device to use
74 my $class = ref($this) || $this;
76 my ($cnt, # Count through data bytes
77 $min_datasize # Minimum data bytes required
82 $proto = $def_proto unless $proto; # Determine the protocol
83 croak('Protocol for ping must be "icmp", "udp", "tcp", "syn", "stream", or "external"')
84 unless $proto =~ m/^(icmp|udp|tcp|syn|stream|external)$/;
85 $self->{"proto"} = $proto;
87 $timeout = $def_timeout unless $timeout; # Determine the timeout
88 croak("Default timeout for ping must be greater than 0 seconds")
90 $self->{"timeout"} = $timeout;
92 $self->{"device"} = $device;
94 $min_datasize = ($proto eq "udp") ? 1 : 0; # Determine data size
95 $data_size = $min_datasize unless defined($data_size) && $proto ne "tcp";
96 croak("Data for ping must be from $min_datasize to $max_datasize bytes")
97 if ($data_size < $min_datasize) || ($data_size > $max_datasize);
98 $data_size-- if $self->{"proto"} eq "udp"; # We provide the first byte
99 $self->{"data_size"} = $data_size;
101 $self->{"data"} = ""; # Construct data bytes
102 for ($cnt = 0; $cnt < $self->{"data_size"}; $cnt++)
104 $self->{"data"} .= chr($cnt % 256);
107 $self->{"local_addr"} = undef; # Don't bind by default
108 $self->{"retrans"} = $def_factor; # Default exponential backoff rate
109 $self->{"econnrefused"} = undef; # Default Connection refused behavior
111 $self->{"seq"} = 0; # For counting packets
112 if ($self->{"proto"} eq "udp") # Open a socket
114 $self->{"proto_num"} = (getprotobyname('udp'))[2] ||
115 croak("Can't udp protocol by name");
116 $self->{"port_num"} = (getservbyname('echo', 'udp'))[2] ||
117 croak("Can't get udp echo port by name");
118 $self->{"fh"} = FileHandle->new();
119 socket($self->{"fh"}, PF_INET, SOCK_DGRAM,
120 $self->{"proto_num"}) ||
121 croak("udp socket error - $!");
122 if ($self->{'device'}) {
123 setsockopt($self->{"fh"}, SOL_SOCKET, SO_BINDTODEVICE(), pack("Z*", $self->{'device'}))
124 or croak "error binding to device $self->{'device'} $!";
127 elsif ($self->{"proto"} eq "icmp")
129 croak("icmp ping requires root privilege") if ($> and $^O ne 'VMS' and $^O ne 'cygwin');
130 $self->{"proto_num"} = (getprotobyname('icmp'))[2] ||
131 croak("Can't get icmp protocol by name");
132 $self->{"pid"} = $$ & 0xffff; # Save lower 16 bits of pid
133 $self->{"fh"} = FileHandle->new();
134 socket($self->{"fh"}, PF_INET, SOCK_RAW, $self->{"proto_num"}) ||
135 croak("icmp socket error - $!");
136 if ($self->{'device'}) {
137 setsockopt($self->{"fh"}, SOL_SOCKET, SO_BINDTODEVICE(), pack("Z*", $self->{'device'}))
138 or croak "error binding to device $self->{'device'} $!";
141 elsif ($self->{"proto"} eq "tcp" || $self->{"proto"} eq "stream")
143 $self->{"proto_num"} = (getprotobyname('tcp'))[2] ||
144 croak("Can't get tcp protocol by name");
145 $self->{"port_num"} = (getservbyname('echo', 'tcp'))[2] ||
146 croak("Can't get tcp echo port by name");
147 $self->{"fh"} = FileHandle->new();
149 elsif ($self->{"proto"} eq "syn")
151 $self->{"proto_num"} = (getprotobyname('tcp'))[2] ||
152 croak("Can't get tcp protocol by name");
153 $self->{"port_num"} = (getservbyname('echo', 'tcp'))[2] ||
154 croak("Can't get tcp echo port by name");
156 $self->{"fork_rd"} = FileHandle->new();
157 $self->{"fork_wr"} = FileHandle->new();
158 pipe($self->{"fork_rd"}, $self->{"fork_wr"});
159 $self->{"fh"} = FileHandle->new();
160 $self->{"good"} = {};
163 $self->{"wbits"} = "";
167 $self->{"stop_time"} = 0;
169 elsif ($self->{"proto"} eq "external")
171 # No preliminary work needs to be done.
177 # Description: Set the local IP address from which pings will be sent.
178 # For ICMP and UDP pings, this calls bind() on the already-opened socket;
179 # for TCP pings, just saves the address to be used when the socket is
180 # opened. Returns non-zero if successful; croaks on error.
184 $local_addr # Name or IP number of local interface
186 my ($ip # Packed IP number of $local_addr
189 croak("Usage: \$p->bind(\$local_addr)") unless @_ == 2;
190 croak("already bound") if defined($self->{"local_addr"}) &&
191 ($self->{"proto"} eq "udp" || $self->{"proto"} eq "icmp");
193 $ip = inet_aton($local_addr);
194 croak("nonexistent local address $local_addr") unless defined($ip);
195 $self->{"local_addr"} = $ip; # Only used if proto is tcp
197 if ($self->{"proto"} eq "udp" || $self->{"proto"} eq "icmp")
199 CORE::bind($self->{"fh"}, sockaddr_in(0, $ip)) ||
200 croak("$self->{'proto'} bind error - $!");
202 elsif ($self->{"proto"} ne "tcp")
204 croak("Unknown protocol \"$self->{proto}\" in bind()");
211 # Description: Allow UDP source endpoint comparision to be
212 # skipped for those remote interfaces that do
213 # not response from the same endpoint.
218 $source_verify = 1 unless defined
219 ($source_verify = ((defined $self) && (ref $self)) ? shift() : $self);
222 # Description: Set whether or not the connect
223 # behavior should enforce remote service
224 # availability as well as reachability.
229 $self->{"econnrefused"} = 1 unless defined
230 ($self->{"econnrefused"} = shift());
233 sub tcp_service_check
238 # Description: Set exponential backoff for retransmission.
239 # Should be > 1 to retain exponential properties.
240 # If set to 0, retransmissions are disabled.
245 $self->{"retrans"} = shift;
248 # Description: allows the module to use milliseconds as returned by
249 # the Time::HiRes module
255 $hires = 1 unless defined
256 ($hires = ((defined $self) && (ref $self)) ? shift() : $self);
257 require Time::HiRes if $hires;
262 return $hires ? Time::HiRes::time() : CORE::time();
265 # Description: Sets or clears the O_NONBLOCK flag on a file handle.
266 sub socket_blocking_mode
269 $fh, # the file handle whose flags are to be modified
270 $block) = @_; # if true then set the blocking
271 # mode (clear O_NONBLOCK), otherwise
272 # set the non-blocking mode (set O_NONBLOCK)
275 if ($flags = fcntl($fh, F_GETFL, 0)) {
276 $flags = $block ? ($flags & ~O_NONBLOCK) : ($flags | O_NONBLOCK);
277 if (!fcntl($fh, F_SETFL, $flags)) {
278 croak("fcntl F_SETFL: $!");
281 croak("fcntl F_GETFL: $!");
285 # Description: Ping a host name or IP number with an optional timeout.
286 # First lookup the host, and return undef if it is not found. Otherwise
287 # perform the specific ping method based on the protocol. Return the
288 # result of the ping.
293 $host, # Name or IP number of host to ping
294 $timeout, # Seconds after which ping times out
296 my ($ip, # Packed IP number of $host
297 $ret, # The return value
298 $ping_time, # When ping began
301 croak("Usage: \$p->ping(\$host [, \$timeout])") unless @_ == 2 || @_ == 3;
302 $timeout = $self->{"timeout"} unless $timeout;
303 croak("Timeout must be greater than 0 seconds") if $timeout <= 0;
305 $ip = inet_aton($host);
306 return () unless defined($ip); # Does host exist?
308 # Dispatch to the appropriate routine.
309 $ping_time = &time();
310 if ($self->{"proto"} eq "external") {
311 $ret = $self->ping_external($ip, $timeout);
313 elsif ($self->{"proto"} eq "udp") {
314 $ret = $self->ping_udp($ip, $timeout);
316 elsif ($self->{"proto"} eq "icmp") {
317 $ret = $self->ping_icmp($ip, $timeout);
319 elsif ($self->{"proto"} eq "tcp") {
320 $ret = $self->ping_tcp($ip, $timeout);
322 elsif ($self->{"proto"} eq "stream") {
323 $ret = $self->ping_stream($ip, $timeout);
325 elsif ($self->{"proto"} eq "syn") {
326 $ret = $self->ping_syn($host, $ip, $ping_time, $ping_time+$timeout);
328 croak("Unknown protocol \"$self->{proto}\" in ping()");
331 return wantarray ? ($ret, &time() - $ping_time, inet_ntoa($ip)) : $ret;
334 # Uses Net::Ping::External to do an external ping.
337 $ip, # Packed IP number of the host
338 $timeout # Seconds after which ping times out
341 eval { require Net::Ping::External; }
342 or croak('Protocol "external" not supported on your system: Net::Ping::External not found');
343 return Net::Ping::External::ping(ip => $ip, timeout => $timeout);
346 use constant ICMP_ECHOREPLY => 0; # ICMP packet types
347 use constant ICMP_ECHO => 8;
348 use constant ICMP_STRUCT => "C2 n3 A"; # Structure of a minimal ICMP packet
349 use constant SUBCODE => 0; # No ICMP subcode for ECHO and ECHOREPLY
350 use constant ICMP_FLAGS => 0; # No special flags for send or recv
351 use constant ICMP_PORT => 0; # No port with ICMP
356 $ip, # Packed IP number of the host
357 $timeout # Seconds after which ping times out
360 my ($saddr, # sockaddr_in with port and ip
361 $checksum, # Checksum of ICMP packet
362 $msg, # ICMP packet to send
363 $len_msg, # Length of $msg
364 $rbits, # Read bits, filehandles for reading
365 $nfound, # Number of ready filehandles found
366 $finish_time, # Time ping should be finished
367 $done, # set to 1 when we are done
369 $recv_msg, # Received message including IP header
370 $from_saddr, # sockaddr_in of sender
371 $from_port, # Port packet was sent from
372 $from_ip, # Packed IP of sender
373 $from_type, # ICMP type
374 $from_subcode, # ICMP subcode
375 $from_chk, # ICMP packet checksum
376 $from_pid, # ICMP packet id
377 $from_seq, # ICMP packet sequence
378 $from_msg # ICMP message
381 $self->{"seq"} = ($self->{"seq"} + 1) % 65536; # Increment sequence
382 $checksum = 0; # No checksum for starters
383 $msg = pack(ICMP_STRUCT . $self->{"data_size"}, ICMP_ECHO, SUBCODE,
384 $checksum, $self->{"pid"}, $self->{"seq"}, $self->{"data"});
385 $checksum = Net::Ping->checksum($msg);
386 $msg = pack(ICMP_STRUCT . $self->{"data_size"}, ICMP_ECHO, SUBCODE,
387 $checksum, $self->{"pid"}, $self->{"seq"}, $self->{"data"});
388 $len_msg = length($msg);
389 $saddr = sockaddr_in(ICMP_PORT, $ip);
390 $self->{"from_ip"} = undef;
391 $self->{"from_type"} = undef;
392 $self->{"from_subcode"} = undef;
393 send($self->{"fh"}, $msg, ICMP_FLAGS, $saddr); # Send the message
396 vec($rbits, $self->{"fh"}->fileno(), 1) = 1;
399 $finish_time = &time() + $timeout; # Must be done by this time
400 while (!$done && $timeout > 0) # Keep trying if we have time
402 $nfound = select((my $rout=$rbits), undef, undef, $timeout); # Wait for packet
403 $timeout = $finish_time - &time(); # Get remaining time
404 if (!defined($nfound)) # Hmm, a strange error
409 elsif ($nfound) # Got a packet from somewhere
414 $from_saddr = recv($self->{"fh"}, $recv_msg, 1500, ICMP_FLAGS);
415 ($from_port, $from_ip) = sockaddr_in($from_saddr);
416 ($from_type, $from_subcode) = unpack("C2", substr($recv_msg, 20, 2));
417 if ($from_type == ICMP_ECHOREPLY) {
418 ($from_pid, $from_seq) = unpack("n3", substr($recv_msg, 24, 4))
419 if length $recv_msg >= 28;
421 ($from_pid, $from_seq) = unpack("n3", substr($recv_msg, 52, 4))
422 if length $recv_msg >= 56;
424 $self->{"from_ip"} = $from_ip;
425 $self->{"from_type"} = $from_type;
426 $self->{"from_subcode"} = $from_subcode;
427 if (($from_pid == $self->{"pid"}) && # Does the packet check out?
428 ($from_seq == $self->{"seq"})) {
429 if ($from_type == ICMP_ECHOREPLY){
434 } else { # Oops, timed out
443 my $ip = $self->{"from_ip"} || "";
444 $ip = "\0\0\0\0" unless 4 == length $ip;
445 return (inet_ntoa($ip),($self->{"from_type"} || 0), ($self->{"from_subcode"} || 0));
448 # Description: Do a checksum on the message. Basically sum all of
449 # the short words and fold the high order bits into the low order bits.
454 $msg # The message to checksum
456 my ($len_msg, # Length of the message
457 $num_short, # The number of short words in the message
458 $short, # One short word
462 $len_msg = length($msg);
463 $num_short = int($len_msg / 2);
465 foreach $short (unpack("n$num_short", $msg))
468 } # Add the odd byte in
469 $chk += (unpack("C", substr($msg, $len_msg - 1, 1)) << 8) if $len_msg % 2;
470 $chk = ($chk >> 16) + ($chk & 0xffff); # Fold high into low
471 return(~(($chk >> 16) + $chk) & 0xffff); # Again and complement
475 # Description: Perform a tcp echo ping. Since a tcp connection is
476 # host specific, we have to open and close each connection here. We
477 # can't just leave a socket open. Because of the robust nature of
478 # tcp, it will take a while before it gives up trying to establish a
479 # connection. Therefore, we use select() on a non-blocking socket to
480 # check against our timeout. No data bytes are actually
481 # sent since the successful establishment of a connection is proof
482 # enough of the reachability of the remote host. Also, tcp is
483 # expensive and doesn't need our help to add to the overhead.
488 $ip, # Packed IP number of the host
489 $timeout # Seconds after which ping times out
491 my ($ret # The return value
495 $ret = $self -> tcp_connect( $ip, $timeout);
496 if (!$self->{"econnrefused"} &&
497 $! == ECONNREFUSED) {
498 $ret = 1; # "Connection refused" means reachable
500 $self->{"fh"}->close();
507 $ip, # Packed IP number of the host
508 $timeout # Seconds after which connect times out
510 my ($saddr); # Packed IP and Port
512 $saddr = sockaddr_in($self->{"port_num"}, $ip);
514 my $ret = 0; # Default to unreachable
516 my $do_socket = sub {
517 socket($self->{"fh"}, PF_INET, SOCK_STREAM, $self->{"proto_num"}) ||
518 croak("tcp socket error - $!");
519 if (defined $self->{"local_addr"} &&
520 !CORE::bind($self->{"fh"}, sockaddr_in(0, $self->{"local_addr"}))) {
521 croak("tcp bind error - $!");
523 if ($self->{'device'}) {
524 setsockopt($self->{"fh"}, SOL_SOCKET, SO_BINDTODEVICE(), pack("Z*", $self->{'device'}))
525 or croak("error binding to device $self->{'device'} $!");
528 my $do_connect = sub {
530 return ($ret = connect($self->{"fh"}, $saddr));
532 my $do_connect_nb = sub {
533 # Set O_NONBLOCK property on filehandle
534 $self->socket_blocking_mode($self->{"fh"}, 0);
536 # start the connection attempt
537 if (!connect($self->{"fh"}, $saddr)) {
538 if ($! == ECONNREFUSED) {
539 $ret = 1 unless $self->{"econnrefused"};
540 } elsif ($! != EINPROGRESS) {
541 # EINPROGRESS is the expected error code after a connect()
542 # on a non-blocking socket. But if the kernel immediately
543 # determined that this connect() will never work,
544 # Simply respond with "unreachable" status.
545 # (This can occur on some platforms with errno
546 # EHOSTUNREACH or ENETUNREACH.)
549 # Got the expected EINPROGRESS.
550 # Just wait for connection completion...
553 vec($wbits, $self->{"fh"}->fileno, 1) = 1;
555 my $nfound = select(undef, ($wout = $wbits), undef, $timeout);
556 warn("select: $!") unless defined $nfound;
558 if ($nfound && vec($wout, $self->{"fh"}->fileno, 1)) {
559 # the socket is ready for writing so the connection
560 # attempt completed. test whether the connection
561 # attempt was successful or not
563 if (getpeername($self->{"fh"})) {
564 # Connection established to remote host
567 # TCP ACK will never come from this host
568 # because there was an error connecting.
570 # This should set $! to the correct error.
572 sysread($self->{"fh"},$char,1);
573 $! = ECONNREFUSED if ($! == EAGAIN && $^O =~ /cygwin/i);
575 $ret = 1 if (!$self->{"econnrefused"}
576 && $! == ECONNREFUSED);
579 # the connection attempt timed out
583 # Connection established to remote host
587 # Unset O_NONBLOCK property on filehandle
588 $self->socket_blocking_mode($self->{"fh"}, 1);
594 # Buggy Winsock API doesn't allow nonblocking connect.
595 # Hence, if our OS is Windows, we need to create a separate
596 # process to do the blocking connect attempt.
598 $| = 1; # Clear buffer prior to fork to prevent duplicate flushing.
599 $self->{'tcp_chld'} = fork;
600 if (!$self->{'tcp_chld'}) {
601 if (!defined $self->{'tcp_chld'}) {
603 warn "Fork error: $!";
608 # Try a slow blocking connect() call
609 # and report the status to the parent.
610 if ( &{ $do_connect }() ) {
611 $self->{"fh"}->close();
615 # Pass the error status to the parent
622 my $patience = &time() + $timeout;
624 my ($child, $child_errno);
625 $? = 0; $child_errno = 0;
626 # Wait up to the timeout
627 # And clean off the zombie
629 $child = waitpid($self->{'tcp_chld'}, &WNOHANG());
630 $child_errno = $? >> 8;
631 select(undef, undef, undef, 0.1);
632 } while &time() < $patience && $child != $self->{'tcp_chld'};
634 if ($child == $self->{'tcp_chld'}) {
635 if ($self->{"proto"} eq "stream") {
636 # We need the socket connected here, in parent
637 # Should be safe to connect because the child finished
642 # Time must have run out.
643 # Put that choking client out of its misery
644 kill "KILL", $self->{'tcp_chld'};
645 # Clean off the zombie
646 waitpid($self->{'tcp_chld'}, 0);
649 delete $self->{'tcp_chld'};
652 # Otherwise don't waste the resources to fork
656 &{ $do_connect_nb }();
664 if ($self->{'proto'} eq 'tcp' &&
665 $self->{'tcp_chld'}) {
666 # Put that choking client out of its misery
667 kill "KILL", $self->{'tcp_chld'};
668 # Clean off the zombie
669 waitpid($self->{'tcp_chld'}, 0);
673 # This writes the given string to the socket and then reads it
674 # back. It returns 1 on success, 0 on failure.
679 my $pingstring = shift;
683 my $wrstr = $pingstring;
689 vec($rin, $self->{"fh"}->fileno(), 1) = 1;
694 vec($rout, $self->{"fh"}->fileno(), 1) = 1;
697 if(select($rin, $rout, undef, ($time + $timeout) - &time())) {
699 if($rout && vec($rout,$self->{"fh"}->fileno(),1)) {
700 my $num = syswrite($self->{"fh"}, $wrstr, length $wrstr);
702 # If it was a partial write, update and try again.
703 $wrstr = substr($wrstr,$num);
705 # There was an error.
710 if(vec($rin,$self->{"fh"}->fileno(),1)) {
712 if(sysread($self->{"fh"},$reply,length($pingstring)-length($rdstr))) {
714 $ret = 1 if $rdstr eq $pingstring;
716 # There was an error.
722 } until &time() > ($time + $timeout) || defined($ret);
731 # Description: Perform a stream ping. If the tcp connection isn't
732 # already open, it opens it. It then sends some data and waits for
733 # a reply. It leaves the stream open on exit.
738 $ip, # Packed IP number of the host
739 $timeout # Seconds after which ping times out
742 # Open the stream if it's not already open
743 if(!defined $self->{"fh"}->fileno()) {
744 $self->tcp_connect($ip, $timeout) or return 0;
747 croak "tried to switch servers while stream pinging"
748 if $self->{"ip"} ne $ip;
750 return $self->tcp_echo($timeout, $pingstring);
753 # Description: opens the stream. You would do this if you want to
754 # separate the overhead of opening the stream from the first ping.
759 $host, # Host or IP address
760 $timeout # Seconds after which open times out
763 my ($ip); # Packed IP number of the host
764 $ip = inet_aton($host);
765 $timeout = $self->{"timeout"} unless $timeout;
767 if($self->{"proto"} eq "stream") {
768 if(defined($self->{"fh"}->fileno())) {
769 croak("socket is already open");
771 $self->tcp_connect($ip, $timeout);
777 # Description: Perform a udp echo ping. Construct a message of
778 # at least the one-byte sequence number and any additional data bytes.
779 # Send the message out and wait for a message to come back. If we
780 # get a message, make sure all of its parts match. If they do, we are
781 # done. Otherwise go back and wait for the message until we run out
782 # of time. Return the result of our efforts.
784 use constant UDP_FLAGS => 0; # Nothing special on send or recv
788 $ip, # Packed IP number of the host
789 $timeout # Seconds after which ping times out
792 my ($saddr, # sockaddr_in with port and ip
793 $ret, # The return value
794 $msg, # Message to be echoed
795 $finish_time, # Time ping should be finished
796 $flush, # Whether socket needs to be disconnected
797 $connect, # Whether socket needs to be connected
798 $done, # Set to 1 when we are done pinging
799 $rbits, # Read bits, filehandles for reading
800 $nfound, # Number of ready filehandles found
801 $from_saddr, # sockaddr_in of sender
802 $from_msg, # Characters echoed by $host
803 $from_port, # Port message was echoed from
804 $from_ip # Packed IP number of sender
807 $saddr = sockaddr_in($self->{"port_num"}, $ip);
808 $self->{"seq"} = ($self->{"seq"} + 1) % 256; # Increment sequence
809 $msg = chr($self->{"seq"}) . $self->{"data"}; # Add data if any
811 if ($self->{"connected"}) {
812 if ($self->{"connected"} ne $saddr) {
813 # Still connected to wrong destination.
814 # Need to flush out the old one.
819 # Need to connect() before send()
823 # Have to connect() and send() instead of sendto()
824 # in order to pick up on the ECONNREFUSED setting
825 # from recv() or double send() errno as utilized in
826 # the concept by rdw @ perlmonks. See:
827 # http://perlmonks.thepen.com/42898.html
829 # Need to socket() again to flush the descriptor
830 # This will disconnect from the old saddr.
831 socket($self->{"fh"}, PF_INET, SOCK_DGRAM,
832 $self->{"proto_num"});
834 # Connect the socket if it isn't already connected
835 # to the right destination.
836 if ($flush || $connect) {
837 connect($self->{"fh"}, $saddr); # Tie destination to socket
838 $self->{"connected"} = $saddr;
840 send($self->{"fh"}, $msg, UDP_FLAGS); # Send it
843 vec($rbits, $self->{"fh"}->fileno(), 1) = 1;
844 $ret = 0; # Default to unreachable
847 my $factor = $self->{"retrans"};
848 $finish_time = &time() + $timeout; # Ping needs to be done by then
849 while (!$done && $timeout > 0)
853 $timeout = $retrans if $timeout > $retrans;
854 $retrans*= $factor; # Exponential backoff
856 $nfound = select((my $rout=$rbits), undef, undef, $timeout); # Wait for response
858 $timeout = $finish_time - &time(); # Get remaining time
860 if (!defined($nfound)) # Hmm, a strange error
865 elsif ($nfound) # A packet is waiting
868 $from_saddr = recv($self->{"fh"}, $from_msg, 1500, UDP_FLAGS);
870 # For example an unreachable host will make recv() fail.
871 if (!$self->{"econnrefused"} &&
872 ($! == ECONNREFUSED ||
874 # "Connection refused" means reachable
880 ($from_port, $from_ip) = sockaddr_in($from_saddr);
881 if (!$source_verify ||
882 (($from_ip eq $ip) && # Does the packet check out?
883 ($from_port == $self->{"port_num"}) &&
884 ($from_msg eq $msg)))
886 $ret = 1; # It's a winner
891 elsif ($timeout <= 0) # Oops, timed out
897 # Send another in case the last one dropped
898 if (send($self->{"fh"}, $msg, UDP_FLAGS)) {
899 # Another send worked? The previous udp packet
900 # must have gotten lost or is still in transit.
901 # Hopefully this new packet will arrive safely.
903 if (!$self->{"econnrefused"} &&
904 $! == ECONNREFUSED) {
905 # "Connection refused" means reachable
916 # Description: Send a TCP SYN packet to host specified.
922 my $start_time = shift;
923 my $stop_time = shift;
926 return $self->ping_syn_fork($host, $ip, $start_time, $stop_time);
929 my $fh = FileHandle->new();
930 my $saddr = sockaddr_in($self->{"port_num"}, $ip);
933 if (!socket ($fh, PF_INET, SOCK_STREAM, $self->{"proto_num"})) {
934 croak("tcp socket error - $!");
937 if (defined $self->{"local_addr"} &&
938 !CORE::bind($fh, sockaddr_in(0, $self->{"local_addr"}))) {
939 croak("tcp bind error - $!");
942 if ($self->{'device'}) {
943 setsockopt($fh, SOL_SOCKET, SO_BINDTODEVICE(), pack("Z*", $self->{'device'}))
944 or croak("error binding to device $self->{'device'} $!");
947 # Set O_NONBLOCK property on filehandle
948 $self->socket_blocking_mode($fh, 0);
950 # Attempt the non-blocking connect
951 # by just sending the TCP SYN packet
952 if (connect($fh, $saddr)) {
953 # Non-blocking, yet still connected?
954 # Must have connected very quickly,
955 # or else it wasn't very non-blocking.
956 #warn "WARNING: Nonblocking connect connected anyway? ($^O)";
958 # Error occurred connecting.
959 if ($! == EINPROGRESS) {
960 # The connection is just still in progress.
961 # This is the expected condition.
963 # Just save the error and continue on.
964 # The ack() can check the status later.
965 $self->{"bad"}->{$host} = $!;
969 my $entry = [ $host, $ip, $fh, $start_time, $stop_time ];
970 $self->{"syn"}->{$fh->fileno} = $entry;
971 if ($self->{"stop_time"} < $stop_time) {
972 $self->{"stop_time"} = $stop_time;
974 vec($self->{"wbits"}, $fh->fileno, 1) = 1;
980 my ($self, $host, $ip, $start_time, $stop_time) = @_;
982 # Buggy Winsock API doesn't allow nonblocking connect.
983 # Hence, if our OS is Windows, we need to create a separate
984 # process to do the blocking connect attempt.
989 my $entry = [ $host, $ip, $pid, $start_time, $stop_time ];
990 $self->{"syn"}->{$pid} = $entry;
991 if ($self->{"stop_time"} < $stop_time) {
992 $self->{"stop_time"} = $stop_time;
996 my $saddr = sockaddr_in($self->{"port_num"}, $ip);
999 if (!socket ($self->{"fh"}, PF_INET, SOCK_STREAM, $self->{"proto_num"})) {
1000 croak("tcp socket error - $!");
1003 if (defined $self->{"local_addr"} &&
1004 !CORE::bind($self->{"fh"}, sockaddr_in(0, $self->{"local_addr"}))) {
1005 croak("tcp bind error - $!");
1008 if ($self->{'device'}) {
1009 setsockopt($self->{"fh"}, SOL_SOCKET, SO_BINDTODEVICE(), pack("Z*", $self->{'device'}))
1010 or croak("error binding to device $self->{'device'} $!");
1014 # Try to connect (could take a long time)
1015 connect($self->{"fh"}, $saddr);
1016 # Notify parent of connect error status
1018 my $wrstr = "$$ $err";
1019 # Force to 16 chars including \n
1020 $wrstr .= " "x(15 - length $wrstr). "\n";
1021 syswrite($self->{"fork_wr"}, $wrstr, length $wrstr);
1031 # Description: Wait for TCP ACK from host specified
1032 # from ping_syn above. If no host is specified, wait
1033 # for TCP ACK from any of the hosts in the SYN queue.
1038 if ($self->{"proto"} eq "syn") {
1040 my @answer = $self->ack_unfork(shift);
1041 return wantarray ? @answer : $answer[0];
1045 if (my $host = shift) {
1046 # Host passed as arg
1047 if (exists $self->{"bad"}->{$host}) {
1048 if (!$self->{"econnrefused"} &&
1049 $self->{"bad"}->{ $host } &&
1050 (($! = ECONNREFUSED)>0) &&
1051 $self->{"bad"}->{ $host } eq "$!") {
1052 # "Connection refused" means reachable
1055 # ECONNREFUSED means no good
1059 my $host_fd = undef;
1060 foreach my $fd (keys %{ $self->{"syn"} }) {
1061 my $entry = $self->{"syn"}->{$fd};
1062 if ($entry->[0] eq $host) {
1064 $stop_time = $entry->[4]
1065 || croak("Corrupted SYN entry for [$host]");
1069 croak("ack called on [$host] without calling ping first!")
1070 unless defined $host_fd;
1071 vec($wbits, $host_fd, 1) = 1;
1073 # No $host passed so scan all hosts
1074 # Use the latest stop_time
1075 $stop_time = $self->{"stop_time"};
1077 $wbits = $self->{"wbits"};
1080 while ($wbits !~ /^\0*\z/) {
1081 my $timeout = $stop_time - &time();
1082 # Force a minimum of 10 ms timeout.
1083 $timeout = 0.01 if $timeout <= 0.01;
1085 my $winner_fd = undef;
1088 # Do "bad" fds from $wbits first
1089 while ($wout !~ /^\0*\z/) {
1090 if (vec($wout, $fd, 1)) {
1091 # Wipe it from future scanning.
1092 vec($wout, $fd, 1) = 0;
1093 if (my $entry = $self->{"syn"}->{$fd}) {
1094 if ($self->{"bad"}->{ $entry->[0] }) {
1103 if (defined($winner_fd) or my $nfound = select(undef, ($wout=$wbits), undef, $timeout)) {
1104 if (defined $winner_fd) {
1107 # Done waiting for one of the ACKs
1109 # Determine which one
1110 while ($wout !~ /^\0*\z/ &&
1111 !vec($wout, $fd, 1)) {
1115 if (my $entry = $self->{"syn"}->{$fd}) {
1116 # Wipe it from future scanning.
1117 delete $self->{"syn"}->{$fd};
1118 vec($self->{"wbits"}, $fd, 1) = 0;
1119 vec($wbits, $fd, 1) = 0;
1120 if (!$self->{"econnrefused"} &&
1121 $self->{"bad"}->{ $entry->[0] } &&
1122 (($! = ECONNREFUSED)>0) &&
1123 $self->{"bad"}->{ $entry->[0] } eq "$!") {
1124 # "Connection refused" means reachable
1126 } elsif (getpeername($entry->[2])) {
1127 # Connection established to remote host
1130 # TCP ACK will never come from this host
1131 # because there was an error connecting.
1133 # This should set $! to the correct error.
1135 sysread($entry->[2],$char,1);
1136 # Store the excuse why the connection failed.
1137 $self->{"bad"}->{$entry->[0]} = $!;
1138 if (!$self->{"econnrefused"} &&
1139 (($! == ECONNREFUSED) ||
1140 ($! == EAGAIN && $^O =~ /cygwin/i))) {
1141 # "Connection refused" means reachable
1144 # No good, try the next socket...
1148 # Everything passed okay, return the answer
1150 ($entry->[0], &time() - $entry->[3], inet_ntoa($entry->[1]))
1153 warn "Corrupted SYN entry: unknown fd [$fd] ready!";
1154 vec($wbits, $fd, 1) = 0;
1155 vec($self->{"wbits"}, $fd, 1) = 0;
1157 } elsif (defined $nfound) {
1158 # Timed out waiting for ACK
1159 foreach my $fd (keys %{ $self->{"syn"} }) {
1160 if (vec($wbits, $fd, 1)) {
1161 my $entry = $self->{"syn"}->{$fd};
1162 $self->{"bad"}->{$entry->[0]} = "Timed out";
1163 vec($wbits, $fd, 1) = 0;
1164 vec($self->{"wbits"}, $fd, 1) = 0;
1165 delete $self->{"syn"}->{$fd};
1169 # Weird error occurred with select()
1171 $self->{"syn"} = {};
1180 my ($self,$host) = @_;
1181 my $stop_time = $self->{"stop_time"};
1183 # Host passed as arg
1184 if (my $entry = $self->{"good"}->{$host}) {
1185 delete $self->{"good"}->{$host};
1186 return ($entry->[0], &time() - $entry->[3], inet_ntoa($entry->[1]));
1193 if (keys %{ $self->{"syn"} }) {
1194 # Scan all hosts that are left
1195 vec($rbits, fileno($self->{"fork_rd"}), 1) = 1;
1196 $timeout = $stop_time - &time();
1197 # Force a minimum of 10 ms timeout.
1198 $timeout = 0.01 if $timeout < 0.01;
1200 # No hosts left to wait for
1206 while ( keys %{ $self->{"syn"} } and
1207 $nfound = select((my $rout=$rbits), undef, undef, $timeout)) {
1208 # Done waiting for one of the ACKs
1209 if (!sysread($self->{"fork_rd"}, $_, 16)) {
1210 # Socket closed, which means all children are done.
1213 my ($pid, $how) = split;
1217 if (my $entry = $self->{"syn"}->{$pid}) {
1218 # Connection attempt to remote host is done
1219 delete $self->{"syn"}->{$pid};
1220 if (!$how || # If there was no error connecting
1221 (!$self->{"econnrefused"} &&
1222 $how == ECONNREFUSED)) { # "Connection refused" means reachable
1223 if ($host && $entry->[0] ne $host) {
1224 # A good connection, but not the host we need.
1225 # Move it from the "syn" hash to the "good" hash.
1226 $self->{"good"}->{$entry->[0]} = $entry;
1227 # And wait for the next winner
1230 return ($entry->[0], &time() - $entry->[3], inet_ntoa($entry->[1]));
1233 # Should never happen
1234 die "Unknown ping from pid [$pid]";
1237 die "Empty response from status socket?";
1240 if (defined $nfound) {
1241 # Timed out waiting for ACK status
1243 # Weird error occurred with select()
1247 if (my @synners = keys %{ $self->{"syn"} }) {
1248 # Kill all the synners
1250 foreach my $pid (@synners) {
1251 # Wait for the deaths to finish
1252 # Then flush off the zombie
1256 $self->{"syn"} = {};
1260 # Description: Tell why the ack() failed
1263 my $host = shift || croak('Usage> nack($failed_ack_host)');
1264 return $self->{"bad"}->{$host} || undef;
1267 # Description: Close the connection.
1273 if ($self->{"proto"} eq "syn") {
1274 delete $self->{"syn"};
1275 } elsif ($self->{"proto"} eq "tcp") {
1276 # The connection will already be closed
1278 $self->{"fh"}->close();
1288 Net::Ping - check a remote host for reachability
1294 $p = Net::Ping->new();
1295 print "$host is alive.\n" if $p->ping($host);
1298 $p = Net::Ping->new("icmp");
1299 $p->bind($my_addr); # Specify source interface of pings
1300 foreach $host (@host_array)
1303 print "NOT " unless $p->ping($host, 2);
1304 print "reachable.\n";
1309 $p = Net::Ping->new("tcp", 2);
1310 # Try connecting to the www port instead of the echo port
1311 $p->{port_num} = getservbyname("http", "tcp");
1312 while ($stop_time > time())
1314 print "$host not reachable ", scalar(localtime()), "\n"
1315 unless $p->ping($host);
1320 # Like tcp protocol, but with many hosts
1321 $p = Net::Ping->new("syn");
1322 $p->{port_num} = getservbyname("http", "tcp");
1323 foreach $host (@host_array) {
1326 while (($host,$rtt,$ip) = $p->ack) {
1327 print "HOST: $host [$ip] ACKed in $rtt seconds.\n";
1330 # High precision syntax (requires Time::HiRes)
1331 $p = Net::Ping->new();
1333 ($ret, $duration, $ip) = $p->ping($host, 5.5);
1334 printf("$host [ip: $ip] is alive (packet return time: %.2f ms)\n", 1000 * $duration)
1338 # For backward compatibility
1339 print "$host is alive.\n" if pingecho($host);
1343 This module contains methods to test the reachability of remote
1344 hosts on a network. A ping object is first created with optional
1345 parameters, a variable number of hosts may be pinged multiple
1346 times and then the connection is closed.
1348 You may choose one of six different protocols to use for the
1349 ping. The "tcp" protocol is the default. Note that a live remote host
1350 may still fail to be pingable by one or more of these protocols. For
1351 example, www.microsoft.com is generally alive but not "icmp" pingable.
1353 With the "tcp" protocol the ping() method attempts to establish a
1354 connection to the remote host's echo port. If the connection is
1355 successfully established, the remote host is considered reachable. No
1356 data is actually echoed. This protocol does not require any special
1357 privileges but has higher overhead than the "udp" and "icmp" protocols.
1359 Specifying the "udp" protocol causes the ping() method to send a udp
1360 packet to the remote host's echo port. If the echoed packet is
1361 received from the remote host and the received packet contains the
1362 same data as the packet that was sent, the remote host is considered
1363 reachable. This protocol does not require any special privileges.
1364 It should be borne in mind that, for a udp ping, a host
1365 will be reported as unreachable if it is not running the
1366 appropriate echo service. For Unix-like systems see L<inetd(8)>
1367 for more information.
1369 If the "icmp" protocol is specified, the ping() method sends an icmp
1370 echo message to the remote host, which is what the UNIX ping program
1371 does. If the echoed message is received from the remote host and
1372 the echoed information is correct, the remote host is considered
1373 reachable. Specifying the "icmp" protocol requires that the program
1374 be run as root or that the program be setuid to root.
1376 If the "external" protocol is specified, the ping() method attempts to
1377 use the C<Net::Ping::External> module to ping the remote host.
1378 C<Net::Ping::External> interfaces with your system's default C<ping>
1379 utility to perform the ping, and generally produces relatively
1380 accurate results. If C<Net::Ping::External> if not installed on your
1381 system, specifying the "external" protocol will result in an error.
1383 If the "syn" protocol is specified, the ping() method will only
1384 send a TCP SYN packet to the remote host then immediately return.
1385 If the syn packet was sent successfully, it will return a true value,
1386 otherwise it will return false. NOTE: Unlike the other protocols,
1387 the return value does NOT determine if the remote host is alive or
1388 not since the full TCP three-way handshake may not have completed
1389 yet. The remote host is only considered reachable if it receives
1390 a TCP ACK within the timeout specifed. To begin waiting for the
1391 ACK packets, use the ack() method as explained below. Use the
1392 "syn" protocol instead the "tcp" protocol to determine reachability
1393 of multiple destinations simultaneously by sending parallel TCP
1394 SYN packets. It will not block while testing each remote host.
1395 demo/fping is provided in this distribution to demonstrate the
1396 "syn" protocol as an example.
1397 This protocol does not require any special privileges.
1403 =item Net::Ping->new([$proto [, $def_timeout [, $bytes [, $device ]]]]);
1405 Create a new ping object. All of the parameters are optional. $proto
1406 specifies the protocol to use when doing a ping. The current choices
1407 are "tcp", "udp", "icmp", "stream", "syn", or "external".
1408 The default is "tcp".
1410 If a default timeout ($def_timeout) in seconds is provided, it is used
1411 when a timeout is not given to the ping() method (below). The timeout
1412 must be greater than 0 and the default, if not specified, is 5 seconds.
1414 If the number of data bytes ($bytes) is given, that many data bytes
1415 are included in the ping packet sent to the remote host. The number of
1416 data bytes is ignored if the protocol is "tcp". The minimum (and
1417 default) number of data bytes is 1 if the protocol is "udp" and 0
1418 otherwise. The maximum number of data bytes that can be specified is
1421 If $device is given, this device is used to bind the source endpoint
1422 before sending the ping packet. I beleive this only works with
1423 superuser privileges and with udp and icmp protocols at this time.
1425 =item $p->ping($host [, $timeout]);
1427 Ping the remote host and wait for a response. $host can be either the
1428 hostname or the IP number of the remote host. The optional timeout
1429 must be greater than 0 seconds and defaults to whatever was specified
1430 when the ping object was created. Returns a success flag. If the
1431 hostname cannot be found or there is a problem with the IP number, the
1432 success flag returned will be undef. Otherwise, the success flag will
1433 be 1 if the host is reachable and 0 if it is not. For most practical
1434 purposes, undef and 0 and can be treated as the same case. In array
1435 context, the elapsed time as well as the string form of the ip the
1436 host resolved to are also returned. The elapsed time value will
1437 be a float, as retuned by the Time::HiRes::time() function, if hires()
1438 has been previously called, otherwise it is returned as an integer.
1440 =item $p->source_verify( { 0 | 1 } );
1442 Allows source endpoint verification to be enabled or disabled.
1443 This is useful for those remote destinations with multiples
1444 interfaces where the response may not originate from the same
1445 endpoint that the original destination endpoint was sent to.
1446 This only affects udp and icmp protocol pings.
1448 This is enabled by default.
1450 =item $p->service_check( { 0 | 1 } );
1452 Set whether or not the connect behavior should enforce
1453 remote service availability as well as reachability. Normally,
1454 if the remote server reported ECONNREFUSED, it must have been
1455 reachable because of the status packet that it reported.
1456 With this option enabled, the full three-way tcp handshake
1457 must have been established successfully before it will
1458 claim it is reachable. NOTE: It still does nothing more
1459 than connect and disconnect. It does not speak any protocol
1460 (i.e., HTTP or FTP) to ensure the remote server is sane in
1461 any way. The remote server CPU could be grinding to a halt
1462 and unresponsive to any clients connecting, but if the kernel
1463 throws the ACK packet, it is considered alive anyway. To
1464 really determine if the server is responding well would be
1465 application specific and is beyond the scope of Net::Ping.
1466 For udp protocol, enabling this option demands that the
1467 remote server replies with the same udp data that it was sent
1468 as defined by the udp echo service.
1470 This affects the "udp", "tcp", and "syn" protocols.
1472 This is disabled by default.
1474 =item $p->tcp_service_check( { 0 | 1 } );
1476 Depricated method, but does the same as service_check() method.
1478 =item $p->hires( { 0 | 1 } );
1480 Causes this module to use Time::HiRes module, allowing milliseconds
1481 to be returned by subsequent calls to ping().
1483 This is disabled by default.
1485 =item $p->bind($local_addr);
1487 Sets the source address from which pings will be sent. This must be
1488 the address of one of the interfaces on the local host. $local_addr
1489 may be specified as a hostname or as a text IP address such as
1492 If the protocol is set to "tcp", this method may be called any
1493 number of times, and each call to the ping() method (below) will use
1494 the most recent $local_addr. If the protocol is "icmp" or "udp",
1495 then bind() must be called at most once per object, and (if it is
1496 called at all) must be called before the first call to ping() for that
1499 =item $p->open($host);
1501 When you are using the "stream" protocol, this call pre-opens the
1502 tcp socket. It's only necessary to do this if you want to
1503 provide a different timeout when creating the connection, or
1504 remove the overhead of establishing the connection from the
1505 first ping. If you don't call C<open()>, the connection is
1506 automatically opened the first time C<ping()> is called.
1507 This call simply does nothing if you are using any protocol other
1510 =item $p->ack( [ $host ] );
1512 When using the "syn" protocol, use this method to determine
1513 the reachability of the remote host. This method is meant
1514 to be called up to as many times as ping() was called. Each
1515 call returns the host (as passed to ping()) that came back
1516 with the TCP ACK. The order in which the hosts are returned
1517 may not necessarily be the same order in which they were
1518 SYN queued using the ping() method. If the timeout is
1519 reached before the TCP ACK is received, or if the remote
1520 host is not listening on the port attempted, then the TCP
1521 connection will not be established and ack() will return
1522 undef. In list context, the host, the ack time, and the
1523 dotted ip string will be returned instead of just the host.
1524 If the optional $host argument is specified, the return
1525 value will be partaining to that host only.
1526 This call simply does nothing if you are using any protocol
1529 =item $p->nack( $failed_ack_host );
1531 The reason that host $failed_ack_host did not receive a
1532 valid ACK. Useful to find out why when ack( $fail_ack_host )
1533 returns a false value.
1537 Close the network connection for this ping object. The network
1538 connection is also closed by "undef $p". The network connection is
1539 automatically closed if the ping object goes out of scope (e.g. $p is
1540 local to a subroutine and you leave the subroutine).
1542 =item pingecho($host [, $timeout]);
1544 To provide backward compatibility with the previous version of
1545 Net::Ping, a pingecho() subroutine is available with the same
1546 functionality as before. pingecho() uses the tcp protocol. The
1547 return values and parameters are the same as described for the ping()
1548 method. This subroutine is obsolete and may be removed in a future
1549 version of Net::Ping.
1555 There will be less network overhead (and some efficiency in your
1556 program) if you specify either the udp or the icmp protocol. The tcp
1557 protocol will generate 2.5 times or more traffic for each ping than
1558 either udp or icmp. If many hosts are pinged frequently, you may wish
1559 to implement a small wait (e.g. 25ms or more) between each ping to
1560 avoid flooding your network with packets.
1562 The icmp protocol requires that the program be run as root or that it
1563 be setuid to root. The other protocols do not require special
1564 privileges, but not all network devices implement tcp or udp echo.
1566 Local hosts should normally respond to pings within milliseconds.
1567 However, on a very congested network it may take up to 3 seconds or
1568 longer to receive an echo packet from the remote host. If the timeout
1569 is set too low under these conditions, it will appear that the remote
1570 host is not reachable (which is almost the truth).
1572 Reachability doesn't necessarily mean that the remote host is actually
1573 functioning beyond its ability to echo packets. tcp is slightly better
1574 at indicating the health of a system than icmp because it uses more
1575 of the networking stack to respond.
1577 Because of a lack of anything better, this module uses its own
1578 routines to pack and unpack ICMP packets. It would be better for a
1579 separate module to be written which understands all of the different
1580 kinds of ICMP packets.
1584 The latest source tree is available via cvs:
1586 cvs -z3 -q -d :pserver:anonymous@cvs.roobik.com.:/usr/local/cvsroot/freeware checkout Net-Ping
1589 The tarball can be created as follows:
1591 perl Makefile.PL ; make ; make dist
1593 The latest Net::Ping release can be found at CPAN:
1595 $CPAN/modules/by-module/Net/
1597 1) Extract the tarball
1599 gtar -zxvf Net-Ping-xxxx.tar.gz
1613 Or install it RPM Style:
1615 rpm -ta SOURCES/Net-Ping-xxxx.tar.gz
1617 rpm -ih RPMS/noarch/perl-Net-Ping-xxxx.rpm
1621 For a list of known issues, visit:
1623 https://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Ping
1625 To report a new bug, visit:
1627 https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-Ping
1632 bbb@cpan.org (Rob Brown)
1635 colinm@cpan.org (Colin McMillen)
1638 bronson@trestle.com (Scott Bronson)
1640 Original pingecho():
1641 karrer@bernina.ethz.ch (Andreas Karrer)
1642 pmarquess@bfsec.bt.co.uk (Paul Marquess)
1644 Original Net::Ping author:
1645 mose@ns.ccsn.edu (Russell Mosemann)
1649 Copyright (c) 2002-2003, Rob Brown. All rights reserved.
1651 Copyright (c) 2001, Colin McMillen. All rights reserved.
1653 This program is free software; you may redistribute it and/or
1654 modify it under the same terms as Perl itself.
1656 $Id: Ping.pm,v 1.81 2003/04/18 04:16:03 rob Exp $