import java.net.URLConnection; import java.net.URL; import java.net.MalformedURLException; import java.io.IOException; import java.io.*; import java.net.*; import java.util.Timer; import java.lang.InterruptedException; public class WIFI { public static void tryconnect() { boolean isconnect = false; try { URL signon = new URL("http://admin:ponds2007@192.168.1.5"); URLConnection login = signon.openConnection(); login.connect(); System.out.println("yupper"); try { FileWriter out = new FileWriter("wificonnectionlog.txt", true); String s = "Still Connected" + datemake.getdate() + '\n'; out.write(s); out.close(); } catch(IOException e) { System.out.println("Error writing the specified file."); } } catch (MalformedURLException e) { System.out.println("no dice" + datemake.getdate()); try { FileWriter out = new FileWriter("wificonnectionlog.txt", true); String s = "No Connection" + datemake.getdate() + '\n'; out.write(s); out.close(); } catch(IOException f) { System.out.println("Error writing the specified file."); } System.out.println("Unable to execute"); } catch (IOException ioe) { System.out.println("no dice" + datemake.getdate()); try { FileWriter out = new FileWriter("wificonnectionlog.txt", true); String s = "No Connection " + datemake.getdate() + '\n'; out.write(s); out.close(); } catch(IOException e) { System.out.println("Error writing the specified file."); } } } public static void main(String args[]) { while(true) { tryconnect(); Object Waiter = new Object(); try {Waiter.wait(500);} catch(InterruptedException a) {System.out.println("interrupted"); } catch(IllegalMonitorStateException a) {System.out.println("illegal monitor");} } } }