new
$p
= Net::Ping->new([proto
[,def_timeout
[,bytes
]]])
Creates a new ping object. All arguments are optional. Takes the following arguments:
proto
The protocol to use when doing a ping. Default is
udp
. The possible
protocols are:
icmp
Sends an icmp
echo
message to the
remote host. If the echoed message is received back
correctly from the remote host, that host is
considered reachable. Requires the program to be run
as root or setuid to root.
tcp
Attempts to establish connection to remote
host’s echo
port.
If successful, remote host is considered reachable. No
data is actually echoed. No special privileges are
required, but overhead is higher than for the
others.
udp
Sends a udp packet to remote host’s echo
port. If the echoed
packet is received back from the remote host and
contains the same data that was sent, the remote host
is considered reachable. Requires no special
privileges.
def_timeout
Default timeout in seconds to be used if timeout not
passed to the ping
method. Must be greater than zero; defaults to five
seconds.
bytes
Number of bytes included in the ping packet sent to
the remote host. Ignored if protocol is tcp. Default is
1
if protocol is udp,
otherwise 0
. These are
also the minimum number of bytes; the maximum is
1,024.
3.144.222.185