Perl Net::ping
发布时间:2020-12-15 23:48:17 所属栏目:大数据 来源:网络整理
导读:use Net::Ping;while (1==1){ $host="202.101.172.35"; $p = Net::Ping-new("icmp"); print "$host is lost.n" unless $p-ping($host,2); } $p-close();$proto specifies the protocol to use when doing a ping. The current choices are "tcp","udp","icm
use Net::Ping;
while (1==1){
$host="202.101.172.35";
$p = Net::Ping->new("icmp");
print "$host is lost.n" unless $p->ping($host,2);
}
$p->close();
$proto
specifies the protocol to use when doing a ping. The current choices
are "tcp","udp","icmp","stream","syn",or "external". The
default is "tcp".
If a default timeout ($def_timeout) in seconds is provided,it is
used when a timeout is not given to the ping() method (below). The
timeout must be greater than 0 and the default,if not specified,is
5 seconds
如果默认的超时是$def_timeout 单位是秒,用于当没有给ping()方法超时设置
默认5秒,默认5秒不通 返回为假
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
