Java 实现Ping功能
一、纯Java实现ICMP的ping命令
?
二、JAVA调用外部EXE实现PING功能
?
三、ICMP Ping in Java(JDK 1.5 and above)
利用Socket的connect(SocketAddress endpoint, int timeout)方法可以实现telnet的功能,如果catch到异常说明telnet失败 try { Socket server = new Socket(); InetSocketAddress address = new InetSocketAddress("192.168.0.113", 8080); server.connect(address, 5000); server.close(); } catch (UnknownHostException e){ System.out.println("telnet失败"); } catch (IOException e){ System.out.println("telnet失败"); }?