dcsimg
Is there a way of obtaining all possible IP Address connections in Java using the java.net library
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   J_Singh
Posted On:   Thursday, December 28, 2006 05:42 PM

i have looked around on Jguru and found something quite close to what im attempting to do however cannot figure the method of fine tuning it to meet my requirements import java.net.InetAddress; import java.net.NetworkInterface; import java.net.SocketException; import java.util.Enumeration; public class Addrs { public static void main(String[] args) throws SocketException { Enumeration ifaces = NetworkInterface.getNetworkInterfaces(); while (ifaces.hasMoreElements()) { NetworkInterface ni = (NetworkInterface)ifaces.nextElement(); System.out.println(ni.getName() + ":"); Enumeration addrs = ni.getInetAddresses(); while (a   More>>

i have looked around on Jguru and found something quite close to what im attempting to do however cannot figure the method of fine tuning it to meet my requirements

			

import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Enumeration;

public class Addrs {
public static void main(String[] args) throws SocketException {
Enumeration ifaces = NetworkInterface.getNetworkInterfaces();

while (ifaces.hasMoreElements()) {
NetworkInterface ni = (NetworkInterface)ifaces.nextElement();
System.out.println(ni.getName() + ":");

Enumeration addrs = ni.getInetAddresses();

while (addrs.hasMoreElements()) {
InetAddress ia = (InetAddress)addrs.nextElement();
System.out.println(" " + ia.getHostAddress());
}
}
}
}




I basically run a program on my server in my network and then run a smaller program upon all of the clients, i am then trying using my server program to scan for all of the possible nodes that are running the small client program.

Or at least establish all possible IP connections available to the server.

Any ideas on how this could be tackled..?    <<Less
About | Sitemap | Contact