Name
new
Synopsis
$p= Net::Ping->new([proto[,def_timeout[,bytes]]])
Creates a new ping object. All arguments are optional. Takes the following arguments:
protoThe protocol to use when doing a ping. Default is
udp. The possible protocols are:icmpSends an
icmpechomessage 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.tcpAttempts to establish connection to remote host’s
echoport. 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.udpSends a udp packet to remote host’s
echoport. 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_timeoutDefault timeout in seconds to be used if timeout not passed to the
pingmethod. Must be greater than zero; defaults to five seconds.bytesNumber of bytes included in the ping packet sent to the remote host. Ignored if protocol is tcp. Default is
1if protocol is udp, otherwise0. These are also the minimum number of bytes; the maximum is 1,024.