Get list of all ip addresses on network in java

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();
        }
  }
}

Output

104.238.65.160
208.109.192.70
Content Protection by DMCA.com
Please Share