commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shlomy Reinstein <>
Subject TelnetClient adds an extra newline
Date Wed, 18 Nov 2009 06:46:08 GMT

First, sorry for a double-post. I initially posted this in the
"issues" mailing list, but got the impression that the "issues" list
is a "one-way" list (i.e. report only).

I use TelnetClient for automation of telnet sessions, and 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 (e.g. when asked for username and
then password, I send the username and '\n' and then the password is
left blank due to the 2nd newline).

I've come across the following link:
which simply says that TelnetClient replaces each '\n' character with
'\r\n', causing the extra newline in my case. However, this link does
not provide a solution (except for changing TelnetClient itself). Is
there a way to configure TelnetClient somehow not to do that?

Trying to work around this issue, I replaced the '\n' characters that
I send with '\r'. This appears to change the behavior in the following
way: The '\r' inserts a single newline, but the next string I send is
*prefixed* with a new line. So, in the "username / password" scenario,
I send the username followed by '\r', then I get the prompt for the
password (and the telnet server waits here for the password). Now I
send the password, but for some reason it is prefixed with a newline,
so the password is again skipped.
Can anyone explain / provide a solution?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message