$p
= Net::Ping->new([proto
[,def_timeout
[,bytes
]]])
Creates a new ping object. All arguments are optional. Takes the following arguments:
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 correctly back
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 as was sent, the remote host is considered reachable. Requires no special privileges.
Default timeout in seconds to be used if timeout not passed
to the ping
method.
Must be greater than zero; defaults to 5 seconds.
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 1024.