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());
}
}
}
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
Post a Comment