そのため、私はisReachableを使用してJavaコードのアドレスに「ping」を実行しています。このコードブロックは、誰もが使用しているように見えるものです。
try
{
InetAddress address = InetAddress.getByName("172.16.2.0");
// Try to reach the specified address within the timeout
// periode. If during this periode the address cannot be
// reach then the method returns false.
boolean reachable = address.isReachable(10000);
System.out.println("Is host reachable? " + reachable);
} catch (Exception e)
{
e.printStackTrace();
}
私の問題は、IPアドレスに何を使用しても、常にtrueが返されることです。空の文字列に変更しても。なぜ何かアイデアはありますか?