I am using InetAddress and I am getting a false response when trying to reach the server. The server is the current latop. Below is the code:
public static void main(String[] args) {
InetAddress i = InetAddress.getByName("ip address of current machine");
System.out.println(i.isReachable(0)); // prints false
System.out.println(i.getHostName());
}
The above prints false and then the actual host name. How can the host name be detected and the same machine is not reachable. What am I doing wrong?