On 26.10.2011 01:02, markspace wrote:
> On 10/25/2011 1:13 PM, Screamin Lord Byron wrote:
>>
>> Did you read my post? It doesn't work because apparently there is no
>> support for raw sockets in Java
>
>
> I'm not sure the RFE relates to fixing existing functionality like
> isReachable().
It doesn't. Not directly, at least. It's an implementation issue.
> I read that as a totally different bug, one that was
> asking for a brand new, direct API for ICMP. It could be the same as
> asking to "fix" isReachable(), but I don't think it's certain at all
> that it does.
If I understand it correctly, this functionality is no longer
implemented since Java 1.3. The InetAddress class was there since Java
1.0. The documentation states: "A typical implementation will use ICMP
ECHO REQUEST...". But since Java 1.3 the ICMP ECHO REQUEST is no longer
an option. I'm guessing they just couldn't be bothered to change that
documentation line.
It is a reasonable explanation on why the code posted by Salim doesn't
work. It works within the same subnet though, but that's because of the
TCP connection on port 7, not ICMP ping.
The bottom line is, as Roedy put it, you can't ping in Java.