commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shlomy Reinstein <srein...@gmail.com>
Subject TelnetClient adds an extra newline
Date Tue, 17 Nov 2009 18:51:06 GMT
Hi,

I use TelnetClient for automation of telnet sessions (something
similar to the 'Expect' tool).
I noticed that whenever I write a newline (\n) to the output stream of
a TelnetClient, two newlines are inserted instead of just one, which
prevents the automation from working, because many commands expect
input on each line, and this extra newline causes each 2nd input line
to be empty.

I've come across the following:
http://www.mail-archive.com/commons-user@jakarta.apache.org/msg17400.html
This explains why it happens, but does not provide a solution. The
explanation (if it's still right for the current version of
TelnetClient) is that the TelnetClient replaces each "\n" with "\r\n",
and it turns out that "\r" and "\n" both account as newlines in my
telnet server.

Is there a way to configure TelnetClient somehow not to do that?
Otherwise, is there a way to trick it somehow so that this does not
happen?
I tried to write just "\r" (instead of "\n"), and this does not always work.

Thanks,
Shlomy

Mime
View raw message