new("icmp");_ping命令1000个包看丢包率">
当前位置:   article > 正文

Ping 1000个包看丢跑率_ping命令1000个包看丢包率

ping命令1000个包看丢包率
  1. <pre name="code" class="sql">use warnings;
  2. use Net::Ping;
  3. $J=0;
  4. $K=0;
  5. for ($i = 1;$i <= 1000;$i++){
  6. if ($#ARGV <0){
  7. print "请输入一个参数\n";
  8. exit(-1);
  9. }
  10. $host = $ARGV[0];
  11. $p = Net::Ping->new("icmp");
  12. if ($p->ping($host,5)){$J++ }
  13. else{$K++}
  14. $p->close();
  15. #sleep(1);
  16. print "$host alive is $J\n";
  17. print "$host lost is $K\n";
  18. }
  19. ##第二个参数为默认超时值($def_timeout),以秒为单位,设置此值是为了定义PING方法的超时值,默认为5
  20. ##第二个参数为默认超时值($def_timeout),以秒为单位,设置此值是为了定义PING方法的超时值,默认为5
  21. If a default timeout ($def_timeout) in seconds is provided, it is
  22. used when a timeout is not given to the ping() method (below). The
  23. timeout must be greater than 0 and the default, if not specified, is
  24. 5 seconds
  25. $p->ping($host [, $timeout]);
  26. Ping the remote host an
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/菜鸟追梦旅行/article/detail/203844
推荐阅读
相关标签
  

闽ICP备14008679号