how to get ip address of systems in multicasting environment..??
hello community members...
i want to know how to get the ip addresses of all systems joined into a multicasting group?
plz tell if there is any facility in java to get the ip address of all machines connected to a LAN; or multicasting environment with the help of java program.
Re: how to get ip address of systems in multicasting environment..??
not sure but try this one :
Code :
import java.net.*;
import java.util.*;
import java.io.*;
import java.nio.*;
public class IPAddress {
public void getInterfaces (){
try {
Enumeration e = NetworkInterface.getNetworkInterfaces();
while(e.hasMoreElements()) {
NetworkInterface ni = (NetworkInterface) e.nextElement();
System.out.println("Net interface: "+ni.getName());
Enumeration e2 = ni.getInetAddresses();
while (e2.hasMoreElements()){
InetAddress ip = (InetAddress) e2.nextElement();
System.out.println("IP address: "+ ip.toString());
}
}
}
catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
IPAddress ip = new IPAddress();
ip.getInterfaces();
}
}