Have you written a telnet application ????

Discussion in 'Java' started by Dale, Aug 21, 2003.

  1. Dale

    Dale Guest

    Hey folks, I was wondering if someone out there had any ideas for me
    since I'm stuck with my application that I'm using to drive a telnet
    based application (screen scraper).

    I started with socket.TelnetIO - a telnet implementation from GNU (see
    below).

    Inside there it says:
    byte TELOPT_TTYPE = (byte)24; /* terminal type */

    But when I run my application, right after it enters userid and
    password I get:

    %SET-W-NOTSET, error modifying VTA684:
    -SET-I-UNKTERM, unknown terminal type
    <TERMINAL SET>

    I think the VTA684 is just a session identifier. The code continues
    to run, though, and I can interact with the menus, but there must be
    something else on one of the deeper menus because when I get to a
    certain menu I get this undefined terminal message "-SMG-F-UNDTERNOP,
    undefined terminal - couldn't access private terminal table" (see
    farther below for the whole thing).

    I wondered if anyone has any ideas for how to proceed.

    --Dale--

    /**
    * socket.TelnetIO - a telnet implementation
    * --
    * $Id: TelnetIO.java,v 1.10 1998/02/09 10:22:18 leo Exp $
    * $timestamp: Tue May 27 13:27:05 1997 by Matthias L. Jugel :$
    *
    * This file is part of "The Java Telnet Applet".
    *
    * This is free software; you can redistribute it and/or modify
    * it under the terms of the GNU General Public License as published
    by
    * the Free Software Foundation; either version 2, or (at your option)
    * any later version.
    *
    * "The Java Telnet Applet" is distributed in the hope that it will be
    * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
    of
    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    * GNU General Public License for more details.
    *
    * You should have received a copy of the GNU General Public License
    * along with this software; see the file COPYING. If not, write to
    the
    * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    * Boston, MA 02111-1307, USA.
    */


    Here's the underfined terminal message, referenced above:

    -SMG-F-UNDTERNOP, undefined terminal - couldn't access private
    terminal table
    %TRACE-F-TRACEBACK, symbolic stack dump follows
    image module routine line rel PC
    abs PC
    DEC$COBRTL 0 000000000003A44C
    000000007C1B444C
    DEC$COBRTL 0 000000000003A170
    000000007C1B4170
    DEC$COBRTL 0 0000000000029910
    000000007C1A3910
    DEC$COBRTL 0 00000000000006B0
    000000007C17A6B0

    TelnetIO.receive(): read bytes: 453
    TelnetIO.negotiate([B@93dcd,453)

    FOCUSFUNCTION 0 0000000000FBC080
    0000000000FCC080
    FOCUSFUNCTION 0 0000000000FBC654
    0000000000FCC654
    PTHREAD$RTL 0 00000000000312FC
    000000007BB9F2FC
    PTHREAD$RTL 0 0000000000012B48
    000000007BB80B48
    0 FFFFFFFF8A72D3F4
    FFFFFFFF8A72D3F4
     
    Dale, Aug 21, 2003
    #1
    1. Advertising

  2. Check out Jakarta commons/net:
    http://jakarta.apache.org/commons/net/index.html


    "Dale" <> wrote in message
    news:...
    > Hey folks, I was wondering if someone out there had any ideas for me
    > since I'm stuck with my application that I'm using to drive a telnet
    > based application (screen scraper).
    >
    > I started with socket.TelnetIO - a telnet implementation from GNU (see
    > below).
     
    Chris Lamprecht, Aug 21, 2003
    #2
    1. Advertising

  3. Dale

    Dale Guest

    Chris, Thanks! Your pointer helped me get around the "-SET-I-UNKTERM,
    unknown terminal type" and other similar issues (I'm just using the
    rlogin example from the commons net utility package, as you
    suggested).

    All, There's one more thing that I would like to conquer... handling
    of control characters.

    What looks to me like this:

    22-Aug-03 03:42 PM AAXXXXX
    MENUOP
    O R D E R P R O C E S S I N G
    29 BULK(snip)
    Comes back like this:

    ?[22;42H0?[22;43H1?[22;42H?[4;3H?[1;19H?[1;69H MENUOP?[2;5H?[7m
    ?[m?[2;1H?[2;9
    H?[7mR?[m?[2;1H?[2;11H?[7mD?[m?[2;1H?[2;13H?[7mE?[m?[2;1H?[2;15H?[7mR?[m?[2;1H?[
    2;17H?[7m P R O C E S?[m?[2;1H?[2;30H?[7mS I N G ?[m?[3;1H?[3;5H?[7m
    ?[m?[3;1H?[
    3;9H?[7mR?[m?[3;1H?[3;11H?[7mD?[m?[3;1H?[3;13H?[7mE?[m?[3;1H?[3;15H?[7mR?[m?[3;1
    H?[3;17H?[7m P R O C E S?[m?[3;1H?[3;30H?[7mS I N G ?[m?[4;1H?[4;41H29
    BULK(snip)

    The part of the page 'O R D E R P R O C E S S I N G' is in big
    letters and is reverse highlighted, and double high characters (on my
    PowerTerm emulator). And obviously some of the stuff on the screen is
    written in a different order and/or is retained from the previous
    menu, but I didn't expect to completely "loose" the "O" from "O R D E
    R" for instance.

    So I guess what I'm wondering is if there's some kind of "virtual
    screen" that someone has come-up with.

    Thanks.

    "Chris Lamprecht" <> wrote in message news:<bi37fs$1b1$>...
    > Check out Jakarta commons/net:
    > http://jakarta.apache.org/commons/net/index.html
    >
    >
    > "Dale" <> wrote in message
    > news:...
    > > Hey folks, I was wondering if someone out there had any ideas for me
    > > since I'm stuck with my application that I'm using to drive a telnet
    > > based application (screen scraper).
    > >
    > > I started with socket.TelnetIO - a telnet implementation from GNU (see
    > > below).
     
    Dale, Aug 22, 2003
    #3
  4. Dale,
    Those appear to be VT100 or ANSI-type terminal escape codes. I'm not
    sure if Jakarta net can do anything with those. If not, you'll have to find
    one or write something yourself that basically strips them out (unless you
    want to display it, but I think you said you were just screen scraping).
    The basic format of the control codes is something like "?[2;1H", where the
    "?" is some non-displayable code. In ANSI it's ASCII code 27 (sometimes
    displays as a little left arrow). It might be the same in VT100, I'm not
    sure (Try google, it knows all). I'm going to have to write almost the
    exact same thing (a scraper) soon; I'd appreciate any code you can share
    with me (I haven't actually used Jakarta Commons/net yet).

    -Chris

    "Dale" <> wrote in message
    news:...
    > All, There's one more thing that I would like to conquer... handling
    > of control characters.
    >
    > What looks to me like this:
    >
    > 22-Aug-03 03:42 PM AAXXXXX
    > MENUOP
    > O R D E R P R O C E S S I N G
    > 29 BULK(snip)
    > Comes back like this:
    >
    > ?[22;42H0?[22;43H1?[22;42H?[4;3H?[1;19H?[1;69H MENUOP?[2;5H?[7m
    > ?[m?[2;1H?[2;9
    >

    H?[7mR?[m?[2;1H?[2;11H?[7mD?[m?[2;1H?[2;13H?[7mE?[m?[2;1H?[2;15H?[7mR?[m?[2;
    1H?[
    > 2;17H?[7m P R O C E S?[m?[2;1H?[2;30H?[7mS I N G ?[m?[3;1H?[3;5H?[7m
    > ?[m?[3;1H?[
    >

    3;9H?[7mR?[m?[3;1H?[3;11H?[7mD?[m?[3;1H?[3;13H?[7mE?[m?[3;1H?[3;15H?[7mR?[m?
    [3;1
    > H?[3;17H?[7m P R O C E S?[m?[3;1H?[3;30H?[7mS I N G ?[m?[4;1H?[4;41H29
    > BULK(snip)
    >
    > The part of the page 'O R D E R P R O C E S S I N G' is in big
    > letters and is reverse highlighted, and double high characters (on my
    > PowerTerm emulator). And obviously some of the stuff on the screen is
    > written in a different order and/or is retained from the previous
    > menu, but I didn't expect to completely "loose" the "O" from "O R D E
    > R" for instance.
    >
    > So I guess what I'm wondering is if there's some kind of "virtual
    > screen" that someone has come-up with.
    >
     
    Chris Lamprecht, Aug 23, 2003
    #4
  5. Dale

    Dale Guest

    Chris,

    Considering you may go down this path, I'll state my findings to date,
    and you can use (and correct/enhance).

    de.mud.jta (http://javassh.org):
    This package is open source. It has a vt320 class that one could
    theoretically use to handle terminal control codes (you talk to the
    vt320 instead of directly to the telnet session). I have not been
    able to get the examples to work with my telnet host. The package is
    extensive (and complicated). I've asked a question on the source
    forge forum to get assistance in where and how one might wire-in a way
    to drive a telnet application (screen scrape).

    com.jscape.inet.telnet (http://www.jscape.com):
    This package is not open source, and it costs a lot (for the tiny part
    I want). It craps-out after 30 days. It has a class specifically
    designed for screen scraping (TelnetScript). Using the example
    TelnetScript partially works against my telnet host (I get connected
    and can do some menus, but I get errors about not handling my terminal
    type, which is a show stopper).

    org.apache.commons.net.telnet
    (http://http://jakarta.apache.org/commons/net/index.html):
    This package is open source. This seems to have no 'terminal'
    classes, which means the control codes look pretty messy. I was able
    to talk to my telnet host without terminal type errors, but later lost
    the ability to talk at all (maybe a firewall issue). The example just
    starts up input and output streams, so is not helpful to suggest how
    to handle screen scraping. I wrote something, but need to get the
    firewall thing fixed to test.

    socket (http://www.first.fraunhofer.de/persons/leo/java/Telnet/)
    This package is open source, but not supported. This appears to be a
    pre-cursor to the de.mud.jta package. This package, though, has a
    class called TelnetWrapper, and a method called receiveUntil that made
    interacting in screen scrape mode very easy. But when I use the
    TelnetWrapper directly, I get the terminal type error on certain
    menus, and the host program bombs. The TelnetWrapper and receiveUntil
    seem not to be included in the current de.mud package.

    --Dale--

    "Chris Lamprecht" <> wrote in message news:<bi8pb9$sn5$>...
    > Dale,
    > Those appear to be VT100 or ANSI-type terminal escape codes. I'm not
    > sure if Jakarta net can do anything with those. If not, you'll have to find
    > one or write something yourself that basically strips them out (unless you
    > want to display it, but I think you said you were just screen scraping).
    > The basic format of the control codes is something like "?[2;1H", where the
    > "?" is some non-displayable code. In ANSI it's ASCII code 27 (sometimes
    > displays as a little left arrow). It might be the same in VT100, I'm not
    > sure (Try google, it knows all). I'm going to have to write almost the
    > exact same thing (a scraper) soon; I'd appreciate any code you can share
    > with me (I haven't actually used Jakarta Commons/net yet).
    >
    > -Chris
    >
    > "Dale" <> wrote in message
    > news:...
    > > All, There's one more thing that I would like to conquer... handling
    > > of control characters.

    (snip)
    > > So I guess what I'm wondering is if there's some kind of "virtual
    > > screen" that someone has come-up with.
    > >
     
    Dale, Aug 24, 2003
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steve C. Orr, MCSD
    Replies:
    1
    Views:
    563
    reaway lee
    Aug 24, 2003
  2. Jim Isaacson
    Replies:
    5
    Views:
    606
    Default User
    Nov 5, 2004
  3. dolphin
    Replies:
    3
    Views:
    367
    rossum
    Mar 9, 2007
  4. shoplifes
    Replies:
    0
    Views:
    311
    shoplifes
    Nov 25, 2007
  5. Carcarius
    Replies:
    0
    Views:
    296
    Carcarius
    Dec 6, 2007
Loading...

Share This Page