Hi all,
I found a behavior difference when running the testcase PingZero on
linux and windows.
On Linux, it prints "reachable" while on windows "unreachable", which is
the same with
the result of running "ping 0.0.0.0" on these two platforms.
Is it a bug or intended?
PingZero.java :
//////////////////////////////////////////////////////////////
import java.net.*;
class PingZero {
public static void main(String args[]) {
try {
InetAddress inetAddress = InetAddress.getByAddress(new byte[] {
0,
0, 0, 0 });
boolean b = inetAddress.isReachable((int) (1.0 * 3000));
if (b) {
System.out.println(" 0.0.0.0 is reachable ! ");
} else {
System.out.println(" 0.0.0.0 is not reachable ! ");
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
//////////////////////////////////////////////////////////////
--
Best Regards,
Sean Chou
PingZero.java
Description: Binary data
