/* Program requirements: */ /* - a TCP/IP (PPP or SLIP) connection via a modem */ /* - JDK 1.1 */ /* */ /* usage: java Cheat X URL */ /* */ /* When this program is running, it makes a connection to the */ /* URL in every X minutes. Therefore, you won't get */ /* disconnected by your ISP even you're away from your PC for */ /* a whole day! */ /* */ /* @author - Owen Chan */ /* */ /* This software is provided "AS IT", without a warranty of */ /* any kind. It can be freely distributed or modified in any */ /* way you like. I'm not responsible for any damages to your */ /* system. You're using it on your own risk! */ import java.net.*; import java.io.*; public class Cheat extends Thread { int sleepingTime = 5; URL myURL; URLConnection urlConn; DataInputStream in; String url; public Cheat(String sleepingTime,String url) { try { this.sleepingTime = Integer.parseInt(sleepingTime); } catch (NumberFormatException e) { System.out.println("usage: java Cheat X_minutes URL"); System.exit(1); } this.url = url; } public void run() { while (true) { try { myURL = new URL(url); urlConn = myURL.openConnection(); in = new DataInputStream(urlConn.getInputStream()); System.out.println("Cheat - OK"); sleep(sleepingTime*60*1000); } catch (Exception e) { System.out.println("Can't connect to " + url); System.exit(1); } } } public static void main(String args[]) { if (args.length >= 2) { Cheat myCheatingProgram = new Cheat(args[0],args[1]); myCheatingProgram.start(); } else { System.out.println("usage: java Cheat X_minutes URL"); } } }