S
sahm
Hi every one
I'm tiring to ping to External IP address (e.x : www.google.com) but I
keep get false every time.
I write function to do the ping. I can ping to local IP address fine,
but when I try to ping any external IP (e.x. www.google.com) it wont
work I keep get false.
this is my code
============ start ===============
package netscan;
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
public class NetPing
{
boolean reach = false;
public boolean pinging()
{
try
{
InetAddress address =
InetAddress.getByName("www.google.com");
reach =address.isReachable(60000);
System.out.println(String.valueOf(reach));
}
catch(UnknownHostException uhe)
{
System.out.println(uhe.toString());
}
catch(IOException io)
{
System.out.println(io.toString());
}
catch(Exception e)
{
System.out.println(e.toString());
}
return reach;
}
}
============ end ===============
Best
Salim
I'm tiring to ping to External IP address (e.x : www.google.com) but I
keep get false every time.
I write function to do the ping. I can ping to local IP address fine,
but when I try to ping any external IP (e.x. www.google.com) it wont
work I keep get false.
this is my code
============ start ===============
package netscan;
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
public class NetPing
{
boolean reach = false;
public boolean pinging()
{
try
{
InetAddress address =
InetAddress.getByName("www.google.com");
reach =address.isReachable(60000);
System.out.println(String.valueOf(reach));
}
catch(UnknownHostException uhe)
{
System.out.println(uhe.toString());
}
catch(IOException io)
{
System.out.println(io.toString());
}
catch(Exception e)
{
System.out.println(e.toString());
}
return reach;
}
}
============ end ===============
Best
Salim