• Post Reply Bookmark Topic Watch Topic
  • New Topic

Commons net telnet - problem when reading replies from the remote server - underline char  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

   Hi.

   I'm using Commons net, version commons-net-3.5.jar to send commands to AIX servers and to read the output to know what to do next (but I verified and the same thing is occurring at commons-net-1.4.1.jar AND ant+telnet)

   In general things work fine, but when I have strings with underline, the reply kind of breaks and makes it very hard to create a robust implementation (I'm using the readUntil strategy, reading output waiting for a specific string). An underline becomes <space><backspace><underline>

   Examples:
   All start with



The commons net TelnetClient class is wrapped inside the telnetObject, which is almost a passthrough.

Then:



which produces

===== COMMAND_SENDER =====:
ls -lat 123.txt
===== HOST_OUTPUT_READER =====:
ls -lat 123.txt
-rw-r--r--    1 someUser pes           21693 Feb 22 2016  123.txt
(someUser)/home/someUser:


Then (now finally showing the problem):



which produces

===== COMMAND_SENDER =====:
ls -lat /esh/programs/prhub/jars/db/prhub_daoTo.jar
===== HOST_OUTPUT_READER =====:
ls -lat /esh/programs/prhub/jars/db/prhub <BS>_daoTo.ja
(someUser)/home/someUser:


Notice 3 things:
1 - at the reply the original underline was replaced by a <space><backspace><underline>. No big deal here
2 - the files permissions were not returned
3 - I think that because of those extra characters, the full name of the file was not returned (a letter is missing at the end).

Keeping things strange: if I read the output again, I get:



ub/jars/db/prhub <BS>_daoTo.jar                         <<BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS>
-rwxrwxr-x    1 someUser pes          179237 Oct 05 19:52 /esh/programs/prhub/jars/db/prhub_daoTo.jar*
(someUser)/home/someUser:


And I noticed that this varies according to the amount of "_" that I send:



===== COMMAND_SENDER =====:
ls -lat /esh/programs/prhub/jars/db/prhub_daoTo.jar /esh/programs/prhub/jars/base/loadAll/prhub_hooks_impl_genericPurpose.jar
===== HOST_OUTPUT_READER =====:
ls -lat /esh/programs/prhub/jars/db/prhub <BS>_daoTo.ja
(someUser)/home/someUser:
===== HOST_OUTPUT_READER =====:
ub/jars/db/prhub <BS>_daoTo.jar                         <<BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS> /esh/programs/prhub/jar
(someUser)/home/someUser:
===== HOST_OUTPUT_READER =====:
/esh/programs/prhub/jars                        <BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS>v<BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS>/base/loadAll/prhub <BS>_hook
(someUser)/home/someUser:
===== HOST_OUTPUT_READER =====:
s/base/loadAll/prhub <BS>_hooks                        <BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS> <BS>_impl <BS>_genericPurpose.jar
-rwxrwxr-x    1 someUser pes          179237 Oct 05 19:52 /esh/programs/prhub/jars/db/prhub_daoTo.jar*
-rwxrwxr-x    1 someUser pes          122673 Oct 05 19:52 /esh/programs/prhub/jars/base/loadAll/prhub_hooks_impl_genericPurpose.jar*
(someUser)/home/someUser:


_________________

I tried the same commands using Ant + Telnet to see if there was something that I could configure while making the connection and I got the exact same output.

I tried to connect passing different TERMs but all produced the same output (xterm, dtterm, VT100).



I researched AIX/linux/etc pages and I see that there's a way to map commands for backspace, but I didn't see anything specific for the underline (and I'm not sure I would solve it running stty or tset). When I use Putty to connect to the server, all works fine.
I think I ran out of options. Can anyone help me???
Thanks in advance

References:
Read Until implementation



sendCommand implementation

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!