Get list of all ip addresses on network
package com.w3spoint;
import java.net.InetAddress;
public class NetworkTest {
public static void main(String args[]){
try {
InetAddress[] hostAddresses = InetAddress.getAllByName("godaddy.com");
for(InetAddress host:hostAddresses){
System.out.println(host.getHostAddress());
}
} catch(Exception e) {
e.printStackTrace();
}
}
} |
package com.w3spoint; import java.net.InetAddress; public class NetworkTest {
public static void main(String args[]){
try {
InetAddress[] hostAddresses = InetAddress.getAllByName("godaddy.com");
for(InetAddress host:hostAddresses){
System.out.println(host.getHostAddress());
}
} catch(Exception e) {
e.printStackTrace();
}
}
}
Output
104.238.65.160
208.109.192.70 |
104.238.65.160
208.109.192.70