List of utility methods to do Host Ping
boolean | ping(final String host, final int timeout) ping try { final InetAddress address = InetAddress.getByName(host); return address.isReachable(timeout); } catch (Throwable ignored) { return false; |
boolean | ping(String host) Checks if the Host is Reachable try { return InetAddress.getByName(host).isReachable(100); } catch (IOException e) { return false; |
boolean | ping(String host, int timeout) ping pingErrorMessage = "No Error"; try { InetAddress address = InetAddress.getByName(host); return address.isReachable(timeout); } catch (Exception e) { pingErrorMessage = e.getMessage(); return false; |
boolean | ping(String host, int timeout) ping try { return InetAddress.getByName(host).isReachable(timeout); } catch (Exception e) { return false; |
void | Ping(String host, int timeout) Tes apakah host/IP bisa dihubungi try { if (InetAddress.getByName(host).isReachable(timeout)) { System.out.printf("%s is reachable %n", host); } else { System.out.printf("%s is unreachable %n", host); } catch (UnknownHostException ex) { System.out.printf("Unknown host: %s%n", host); ... |
boolean | ping(String host, int timeout) ping InetAddress address = null; try { address = InetAddress.getByName(host); } catch (UnknownHostException e) { e.printStackTrace(); return false; boolean b = false; ... |