try{ long tm = System.currentTimeMillis(); Socket so = new Socket("127.0.0.1",80); so.close(); tm = System.currentTimeMillis() - tm;}catch( Exception ex ){ System.out.println("Rechner nicht erreichbar");}