thufir

Untitled

Aug 28th, 2013
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. package teln;
  2.  
  3. import java.io.BufferedReader;
  4. import java.io.IOException;
  5. import java.io.InputStream;
  6. import java.io.InputStreamReader;
  7. import java.net.SocketException;
  8. import java.util.Properties;
  9. import org.apache.commons.net.telnet.TelnetClient;
  10.  
  11. public final class ConnectMUD {
  12.  
  13. private static String EOL = "/[#]/";
  14. private static TelnetClient tc;
  15.  
  16. public static void main(String[] args) throws SocketException, IOException {
  17. Properties props = PropertiesReader.getProps();
  18. String server = props.getProperty("server");
  19. String port = props.getProperty("port");
  20. tc = new TelnetClient();
  21. tc.connect(server, Integer.getInteger(port).intValue());
  22. //tc.connect("rainmaker.wunderground.com", 3000);
  23. readLines(tc.getInputStream());
  24. }
  25.  
  26. private static void readLines(InputStream in) throws IOException {
  27.  
  28. InputStreamReader is = new InputStreamReader(in);
  29. StringBuilder sb = new StringBuilder();
  30. BufferedReader br = new BufferedReader(is);
  31. String read = br.readLine();
  32.  
  33. while (read != null) {
  34. sb.append(read);
  35. read = br.readLine();
  36. Parse.printString(read);
  37. }
  38. }
  39.  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment