Java examples for Network:Ping
is IP Reachable
//package com.java2s; import java.net.InetAddress; public class Main { public static boolean isReachable(String ip, int timeout) { try {// www .ja v a 2 s .c o m InetAddress address = InetAddress.getByName(ip); return address.isReachable(timeout); } catch (Exception e) { e.printStackTrace(); } return false; } public static boolean isReachable(String ip) { return isReachable(ip, 5000); } }