How to get all local machine IP addresses ??


Web tier: servlets, JSP, Web frameworks: How to get all local machine IP addresses ??

  1. How to get all local machine IP addresses ?? (2 messages)

    Hi, I wrote a port scanner, it's working fine, but the two nested for loop :
       final int start = 0;
      final int end = 255;
      for (int i = start; i <= end; i++)
         for (int j = start + 1; j <= end - 1; j++)

    take too long, how can I all local machine IP addresses ??

  2. I'm not sure I understand exactly what you need it for, but JDK1.4 has a new NetworkInterface class that allows you to get all of the machines network interface, and the addresses associated with them.

  3. Meaning the IPs of all computers on the network? Are we talking about network discovery?

    What are the two loops for? Looping on the last byte of the IP is sufficient for discovering the LAN. Do you have a masked network?

    I would do it by broadcasting several ICMP packets and recording the ICMP replies, but I don't know how to do it in Java (requires internal structures etc. in Unix). Another method that I know of is employed by CA's Unicenter TNG, which can discover huge networks by accessing routers' ARP caches.