hi,
i'm wanting to do a for loop on the last line
System.out.println(host + "\t" + status);
of this bit of code so that when i replace
String host = "server";
with something like this:
String hostarray[] = {"pc","server","pc2","another","etc"};
that i get output that looks like this:
Server Up?
pc true
server false
pc2 true
another true
etc true
and this is where i am... and no, i'm no programmer...
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
class isup {
public static void main (String args[]) throws
UnknownHostException, IOException{
String host = "server"; // pc or server name
int timeOut = 3000; // milliseconds
boolean status = InetAddress.getByName(host).isReachable(timeOut); // status is true or false
System.out.println("Server\t\tUp?"); // table heading
System.out.println(host + "\t" + status); // list of servers and up or not - the tab thing needs some work...
}
}
thanks in advance... :)