|$obj = Net::Oping-><B>newB> ();||Creates and returns a new object.|
|$status = $obj-><B>timeoutB> ($timeout);||Sets the timeout before a host is considered unreachable to $timeout seconds, which may be a floating point number to specify fractional seconds.|
|$status = $obj-><B>ttlB> ($ttl);||Sets the Time to Live (TTL) of outgoing packets. $ttl must be in the range <B>1B> ... <B>255B>. Returns true when successful and false when an error occurred.|
|$status = $obj-><B>bindB> ($ip_addr);||Sets the source IP-address to use. $ip_addr must be a string containing an IP-address, such as 192.168.0.1 or 2001:f00::1. As a side-effect this will set the address-family (IPv4 or IPv6) to a fixed value, too, for obvious reasons.|
|$status = $obj-><B>deviceB> ($device);||
Sets the network device used for communication. This may not be supported on
Requires liboping 1.3 or later.
|$status = $obj-><B>host_addB> ($host, [$host, ...]);||Adds one or more hosts to the Net::Oping-object $obj. The number of successfully added hosts is returned. If this number differs from the number of hosts that were passed to the method you can use <B>get_errorB> (see below) to get the error message of the last failure.|
|$status = $obj-><B>host_removeB> ($host, [$host, ...]);||Same semantic as <B>host_addB> but removes hosts.|
|$latency = $obj-><B>pingB> ()||
The central method of this module sends ICMP packets to the hosts and waits for
replies. The time it takes for replies to arrive is measured and returned.
The returned scalar is a hash reference where each host associated with the $obj object is a key and the associated value is the corresponding latency in milliseconds. An example hash reference would be:
If a value is undef, as for host2 in this example, the host has timed out and considered unreachable.
|$dropped = $obj-><B>get_droppedB> ()||
Returns a hash reference holding the number of drops (echo requests which
were not answered in time) for each host. An example return
values would be:
Hosts to which no data has been sent yet will return undef (host3 in thie example).
|$ttl = $obj-><B>get_recv_ttlB> ()||
Returns a hash reference holding the Time to Live (TTL) of the last received
packet for each host. An example return value would be:
To signal an invalid or unavailable TTL, a negative number is returned.
|$errmsg = $obj-><B>get_errorB> ();||Returns the last error that occurred.|
The oping library opens a raw socket to be able to send ICMP packets. On most systems normal users are not allowed to do this. This is why on most systems the ping(1) utility is installed as SetUID-root. Since, when using this module, no external process is spawned <B>thisB> process needs the appropriate permissions. This means that either your script has to run as superuser or, under Linux, needs the CAP_NET_RAW capability.
First XS port by Olivier Fredj, extended XS functionality and high-level Perl interface by Florian Forster.
Copyright (C) 2007 by Olivier Fredj <ofredj at proxad.net>
Copyright (C) 2008,2009 by Florian Forster <octo at verplant.org>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.7 or, at your option, any later version of Perl 5 you may have available.
Please note that liboping is licensed under the GPLv2. Derived works of both, Net::Oping and liboping, (i. e. binary packages) may therefore be subject to stricter licensing terms than the source code of this package.
|perl v5.20.3||NET::OPING (3)||2011-03-12|