1 16 package examples; 17 18 import java.io.IOException ; 19 import org.apache.commons.net.telnet.TelnetClient; 20 21 33 34 public final class weatherTelnet 36 { 37 38 public final static void main(String [] args) 39 { 40 TelnetClient telnet; 41 42 telnet = new TelnetClient(); 43 44 try 45 { 46 telnet.connect("rainmaker.wunderground.com", 3000); 47 } 48 catch (IOException e) 49 { 50 e.printStackTrace(); 51 System.exit(1); 52 } 53 54 IOUtil.readWrite(telnet.getInputStream(), telnet.getOutputStream(), 55 System.in, System.out); 56 57 try 58 { 59 telnet.disconnect(); 60 } 61 catch (IOException e) 62 { 63 e.printStackTrace(); 64 System.exit(1); 65 } 66 67 System.exit(0); 68 } 69 70 } 71 72 73 | Popular Tags |