Well long story short I'm trying to build a list of valid IP addresses.
At work we use the a CLASS C which leaves the IP range from 10.0.0.0 - 10.255.255.255
which is equivalent to 256^3 = 16,777,216. Anyways long story short I work in a large building and I am attempting to develop this application that allows us to determine if any machines have been left on by pinging them. If the ping comes back than the machine was left on. The reason I want to do it in this fashion is because we are looking to expand and this allows me to scan the whole range of IP's no matter if we add computers or not.
Heres my code: The only problem is it takes several minutes. Is there a quicker way?
private String[] buildIPList() {
String []ips = null;
int i = 0;
int A = 10;
for (int B = 0;B < 256; B++ ){
for (int C = 0;C < 256; C++ ){
for (int D = 0;D < 256; D++ ){
ips[i] = (A+"."+B+"."+C+"."+D);
i++;
}
}
}
return ips;
}
Thanks in advance.