private String[] getActiveComputers ()
{
StringTokenizer st = new StringTokenizer ("");
try{
Runtime rt = Runtime.getRuntime ();
Process p = rt.exec ("net view");
BufferedReader br = new BufferedReader (
new InputStreamReader (p.getInputStream ()));
StringBuffer sb = new StringBuffer (500);
String s = "";
while ((s = br.readLine ()) != null){
sb = sb.append (s);
}
st = new StringTokenizer (sb.toString (), "\n\t ");
p.waitFor ();
if (p.exitValue () != 0)
throw new IOException ("");
}catch (IOException e){
System.out.println("Fehler bei der Suche nach Computern");
}catch (InterruptedException ie){}
String s;
Vector v = new Vector ();
while (st.hasMoreTokens ()){
s = st.nextToken ();
if (s.startsWith ("Beschreibung")){
s = s.substring (12);
while (s.startsWith ("-")){
s = s.substring (1);
}}
if (s.startsWith ("\\\\")){
s = s.substring (2);
try{
InetAddress ia = InetAddress.getByName (s);
v.addElement (s);
}catch (UnknownHostException uhe){}
}
}
String[] ret = new String[v.size ()];
java.util.Enumeration e = v.elements ();
for (int i = 0; e.hasMoreElements (); ++i){
ret[i] = (String) e.nextElement ();
}
return ret;
}