permaculture playing cards
The moose likes Sockets and Internet Protocols and the fly likes Telnet and windows characters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Telnet and windows characters" Watch "Telnet and windows characters" New topic

Telnet and windows characters

Jekin Eiriksen

Joined: Oct 28, 2004
Posts: 3
Hey folks,
My first post here, so be gentle

I seem to have run into a quite a problem with the MS telnet server. I'm writing an application that will connect to a remote machine and execute a few scripts there.
I'm using jakarta net for the connection. It all seems to work fine, but when I do connect to the machine, I'm getting a whole load of MS-specific mumbo jumbo that I can't seem to avoid. Here's how it looks from my side:

$ java TelnetConnect
Microsoft (R) Windows (TM) Version 5.00 (Build 2195)
Welcome to Microsoft Telnet Service
Telnet Server Build 5.00.99201.1
***←[1;1H*=============================================================== ←[2;1HWelcome to Microsoft Telnet Server.
←[4;1HC:\> sh javatest/test.ksh
←[24;1H←[K←[25;1H←[K←[4;5H←[4;5Hsh javatest/test.ksh←[5;1HTest.ksh from RUSH was successful!←[7;1HC:\>ls -1
←[7;5H←[1;1HProgram Files ←[2;1HRegister ←[3;1HWINNT
←[4;1HWinZip ←[5;1Hbc_Build_bundle031.txt ←[6

Now, when I connect to a unix machine, it all seems to work perfectly.

Is there some parser package for this or a connection option? I looked everywhere and can't seem to find a solution.

Alex Pakhomov

Joined: Mar 12, 2001
Posts: 11
Jekin, are you running your program in a DOS window? If yes, it does not understand VT100 (or other terminal's) control characters. The XTerm window does terminal emulation correctly.
Jekin Eiriksen

Joined: Oct 28, 2004
Posts: 3
Hey Alex,

I tried running this from within MKS Toolkit (Korn shell), Cygwin, and cmd - all with the same result
Van Glass
Ranch Hand

Joined: Nov 18, 2000
Posts: 110
terminal emulation is supposed to be option as part of the option negotiation process. Unfortunately the telnet server that comes with Windows seems to be a poor implementation as it ignores the telnet client when the telnet client refuses terminal emulation. In this case the Windows server sends the emulated data anyway. Unfortunately the only option is to use a different server that properly follows the option negotiation standard or parse the emulated data.
Jekin Eiriksen

Joined: Oct 28, 2004
Posts: 3
Thanks for the clarification Van Glass! I guess I'll have to find a new server.
I agree. Here's the link:
subject: Telnet and windows characters
It's not a secret anymore!