Ultra Geile Studenten Benutzer Oberfläche (UGSBO)
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
package com.ugsbo.FirewallOfDeath;
import java.io.IOException; import java.net.HttpURLConnection; import java.net.URL; import java.net.UnknownHostException;
class NetzFunktion {
/*** * sendet einen Ping an google * @return boolean können wir google erreichen oder nicht? * @throws IOException * @throws UnknownHostException */ public static boolean pingTogoogle() throws IOException,UnknownHostException { //Googel IP adresse
try { URL url = new URL("http://www.google.com");
//open a connection to that source
HttpURLConnection urlConnect = (HttpURLConnection)url.openConnection();
//Gibt es keine Verbindung schlägt diese Zeile fehl.
@SuppressWarnings("unused") Object objData = urlConnect.getContent(); }catch (Exception e) { e.printStackTrace(); return false; } return true; }
}
|