Package de.mud.telnet

Examples of de.mud.telnet.TelnetWrapper


    new TelnetClient(System.in, System.out, host, port);
  }

  public TelnetClient(InputStream in, PrintStream out,
                      String host, int port) {
    TelnetWrapper telnetWrapper = new TelnetWrapper();
    try {
      telnetWrapper.connect(host, port);
    } catch (IOException e) {
      System.out.println("TelnetClient: Got exception during connect: " + e);
      e.printStackTrace();
    }
    createAndStartReader(telnetWrapper, out);
    byte[] buf = new byte[256];
    int n = 0;
    try {
      while (n >= 0) {
        n = in.read(buf);
        if (n > 0) {
          byte[] sendBuf = new byte[n];
          System.arraycopy(buf, 0, sendBuf, 0, n);
          // Must be transpose (not send) or connect is closed.
          telnetWrapper.getHandler().transpose(sendBuf);
        }
      }
    } catch (IOException e) {
      System.out.println("TelnetClient: Got exception in read/write loop: " + e);
      e.printStackTrace();
      return;
    } finally {
      try {
        telnetWrapper.disconnect();
      } catch (IOException e) {
        System.out.println("TelnetClient: got exception in disconnect: " + e);
        e.printStackTrace();
      }
    }
View Full Code Here


   * Creates a new GeoFix object, setting the port and creating the TelnetWrapper object.
   * @param port
   */
  public GeoFix(final int port){
    _port = port;
    _telnet = new TelnetWrapper();
  }
View Full Code Here

TOP

Related Classes of de.mud.telnet.TelnetWrapper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.