一.模拟ping的实现


利用InetAddress的isReachable方法可以实现ping的功能,里面参数设定超时时间,返回结果表示是否连上。

        }

 

二.模拟telnet的实现 

利用Socket的connect(SocketAddress endpoint, int timeout)方法可以实现telnet的功能,如果catch到异常说明telnet失败

使用java简单模拟ping和telnet的实现        Socket server = null;
        }

相关文章:

  • 2021-12-19
  • 2021-11-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-13
  • 2020-05-04
  • 2022-02-20
猜你喜欢
  • 2021-11-07
  • 2022-01-30
  • 2021-12-07
  • 2022-01-07
  • 2022-01-05
  • 2022-12-23
相关资源
相似解决方案