PingIPAddress

import java.net.*;

public class PingIPAddress {
  public static void main(String[] args) {

    try
    {
      String ipAddress = "172.16.101.6";
      InetAddress inet = InetAddress.getByName(ipAddress);
      System.out.println("Sending Ping Request to " + ipAddress);
      if (inet.isReachable(5000)){
        System.out.println(ipAddress + " is reachable.");
      } else {
        System.out.println(ipAddress + " NOT reachable.");
      }
    }
     catch ( Exception e )
     {
      System.out.println("Exception:" + e.getMessage());
     }
  }
}

Comments

Popular posts from this blog

Exp : 1 & 2 : Working with HTML and CSS

DV and LS Routing Algorithm Implementation in ns2

JAVA PROGRAMMING QUESTION BANK FOR PTT-1 (ACADEMIC YEAR 2015-16)