Results 1 to 5 of 5
- 08-02-2011, 06:08 PM #1
Member
- Join Date
- May 2010
- Location
- Florida
- Posts
- 68
- Rep Power
- 0
Problem with apache.commons.telnet library
Hi
I am using the apache.commons.net.telnet library (Example of use of Telnet Client : Telnet*«*Network Protocol*«*Java)
I used the example provided in the link above to connect to a Mikrotik router board but I got the following issues:
1- When I use the telnet client in windows to communicate with the Mikrotik everything works just fine and there is no delay, but when I use the library mentioned above it takes about 4 to 5 seconds to get a response from the device for every command.
2- I am encountering what seems to be encoding problems: for example when I type the username and password I get [m36 [m36 [m in the end of the reply which I don't get when I use the Telnet client provided by windows.
Although this seems to be a very dump question but any ideas, comments, reviews because I have tried too many different solutions but I ended up with nothing.
Any recommendations for alternative telnet libraries are more than welcome.
Best Regards.
Anderson.
- 08-03-2011, 01:47 AM #2
The [m thing is a VT220 control code. Actually it's preceded by the escape character, which doesn't have a printable representation. I wrote some Telnet/VT220 stuff recently for a MUD, and found that although Telnet and VT220 have different origins and a lot of functional overlap, most "Telnet" clients nowadays actually use a mishmash of the two protocols. A strict implementation of either probably won't do you much good for anything, except maybe connecting to an old teletype machine.
As for the delay: are you flushing your output stream after every write?Get in the habit of using standard Java naming conventions!
- 08-03-2011, 01:55 AM #3
Oh, and I'd be flattered if you gave my library a try. It contains a class called BogusNVT that provides very minimal functionality for communicating with "Telnet" devices. Basically I took a lot of shortcuts based on the assumption that it won't be talking with any real VT220s. There's a simple demo program in the demo package.
It occurred to me the other day that there might be a bug in my RegExpEatingReader, namely that I think it's eating the shortest match instead of the longest match... but that shouldn't affect the operation of BogusNVT.Last edited by kjkrum; 08-03-2011 at 01:57 AM.
Get in the habit of using standard Java naming conventions!
- 08-03-2011, 07:22 PM #4
Member
- Join Date
- May 2010
- Location
- Florida
- Posts
- 68
- Rep Power
- 0
Dear Kjkrum
Thank you for reply helpful reply it makes a lot of sense now regarding the [m because the apache.commons.net.telnet library implements the telnet VT100 not the VT220.
I am flushing the output after each write as shown below:
out.write();
out.fllush();
I will try your library and inform you about the results.
Once again thank you for your information.
Regards.
Anderson.
- 08-03-2011, 07:32 PM #5
A code like "escape[36m" should also be valid to a VT100 emulator. I don't think "escape[m" is valid in VT100, VT220, or ANSI X3.64, but I think some old BBS software started using it to mean "reset attributes", and it stuck around despite being non-standard. (The correct way to reset attributes is "escape[0m".)
Get in the habit of using standard Java naming conventions!
Similar Threads
-
Apache Commons Math Transform library.
By blind melon in forum Advanced JavaReplies: 1Last Post: 12-05-2010, 05:25 AM -
Possible library problem for apache common fileupload
By Kelly in forum Java ServletReplies: 1Last Post: 05-19-2010, 09:10 AM -
apache commons vfs delete directory with dependancies
By turanan in forum New To JavaReplies: 0Last Post: 06-16-2009, 03:35 PM -
Problems with ftp, commons library
By jurka in forum NetworkingReplies: 0Last Post: 09-01-2008, 05:46 PM -
Commons Library Framework 0.8.0
By JavaBean in forum Java SoftwareReplies: 0Last Post: 10-02-2007, 04:13 PM


2Likes
LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks