NAME
Net::Ping - check a remote host for reachability
检查远程主机是否可达
SYNOPSIS
简介
use Net::Ping;
$p = Net::Ping->new();
print "$host is alive.\n" if $p->ping($host);
$p->close();
$p = Net::Ping->new("icmp");
$p->bind($my_addr); # Specify source interface of pings
foreach $host (@host_array)
{
print "$host is ";
print "NOT " unless $p->ping($host, 2);
print "reachable.\n";
sleep(1);
}
$p->close();
$p = Net::Ping->new("tcp", 2);
# Try connecting to the www port instead of the echo port
$p->port_number(getservbyname("http", "tcp"));
while ($stop_time > time())
{
print "$host not reachable ", scalar(localtime()), "\n"
unless $p->p
Net::Ping 模块详解
最新推荐文章于 2024-08-03 05:09:09 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)