check ip addresses in network code example
Example 1: what use of ip addresses
import java.net.InetAddress;
import java.net.UnknownHostException;
public class FindIPaddress {
public static void main(String[] args) throws UnknownHostException {
InetAddress a = InetAddress.getLocalHost();
System.out.println(a.getHostAddress());
}
}
Example 2: how to find the ip address of a remote device on network
Server: ns.indiana.edu
Address: 129.79.1.1
Name: indiana.edu
Address: 129.79.1.61