Mega Code Archive

 
Categories / Java Tutorial / Network
 

Ping a host

import java.net.InetAddress; public class Main {   public static void main(String[] args) throws Exception {     InetAddress address = InetAddress.getByName("17.16.15.14");     boolean reachable = address.isReachable(10000);     System.out.println("Is host reachable? " + reachable);   } }