Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #9148
| From | sahm <sahm007@gmail.com> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Ping from JAVA to IP Address |
| Date | 2011-10-24 11:01 -0700 |
| Organization | http://groups.google.com |
| Message-ID | <670cd44b-d05f-4300-9c59-b26f28e17323@j36g2000prh.googlegroups.com> (permalink) |
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
Back to comp.lang.java.programmer | Previous | Next — Next in thread | Find similar | Unroll thread
Ping from JAVA to IP Address sahm <sahm007@gmail.com> - 2011-10-24 11:01 -0700
Re: Ping from JAVA to IP Address Robert Klemme <shortcutter@googlemail.com> - 2011-10-24 20:26 +0200
Re: Ping from JAVA to IP Address markspace <-@.> - 2011-10-24 14:52 -0700
Re: Ping from JAVA to IP Address sahm <sahm007@gmail.com> - 2011-10-24 22:31 -0700
Re: Ping from JAVA to IP Address sahm <sahm007@gmail.com> - 2011-10-25 01:56 -0700
Re: Ping from JAVA to IP Address Screamin Lord Byron <scre@min.dot> - 2011-10-25 11:57 +0200
Re: Ping from JAVA to IP Address markspace <-@.> - 2011-10-25 08:12 -0700
Re: Ping from JAVA to IP Address Screamin Lord Byron <scre@min.dot> - 2011-10-25 22:13 +0200
Re: Ping from JAVA to IP Address markspace <-@.> - 2011-10-25 16:02 -0700
Re: Ping from JAVA to IP Address Screamin Lord Byron <scre@min.dot> - 2011-10-26 13:16 +0200
Re: Ping from JAVA to IP Address Arne Vajhøj <arne@vajhoej.dk> - 2011-11-06 15:29 -0500
Re: Ping from JAVA to IP Address glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2011-12-07 08:59 +0000
Re: Ping from JAVA to IP Address Roedy Green <see_website@mindprod.com.invalid> - 2011-10-25 21:28 -0700
Re: Ping from JAVA to IP Address Arne Vajhøj <arne@vajhoej.dk> - 2011-11-06 15:36 -0500
csiph-web