commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Wikman" <>
Subject Re: TelnetClient problem?
Date Mon, 11 Dec 2006 06:18:25 GMT

Ummm, ohhh, seems like I will have problems doing that... Since the __output 
private simply overriding _connectAction_ does not do the trick, i need to 
the existing stuff which I do not want to. Rory, isn't it in the products 
own interest
to be able to communicate with all possible nodes no matter of platform? 
'\r\n' is in
fact a windowze construct, and I operate mostly on solaris/linux but also of 
course on
windows. Shouldn't this be made configurable???



>From: "Daniel Wikman" <>
>Reply-To: "Jakarta Commons Users List" <>
>Subject: Re: TelnetClient problem?
>Date: Sat, 09 Dec 2006 17:04:07 +0100
>Got it! Exellent answer, I'll have a look at it again, now I am using 
>ProcessBuilder instead,
>since that works..., but using a library feels safer...
>>From: Rory Winston <>
>>Reply-To: "Jakarta Commons Users List" <>
>>To: Jakarta Commons Users List <>,  
>>Subject: Re: TelnetClient problem?
>>Date: Tue, 05 Dec 2006 23:35:36 +0000
>>Hi Daniel
>>This is handled in TelnetClient::_connectAction(). The output stream is 
>>wrapped in a ToNetASCIIOutputStream, which replaces all \n with \r\n. A 
>>quick fix for your serial blackbox system may (I havent tried this) be to 
>>replace the line
>>__output = new ToNetASCIIOutputStream(new TelnetOutputStream(this));
>>__output = new BufferedOutputStream(new TelnetOutputStream(this));
>>protected void _connectAction_() throws IOException
>>    {
>>        super._connectAction_();
>>        InputStream input;
>>        TelnetInputStream tmp;
>>        if (FromNetASCIIInputStream.isConversionRequired())
>>            input = new FromNetASCIIInputStream(_input_);
>>        else
>>            input = _input_;
>>        tmp = new TelnetInputStream(input, this, readerThread);
>>        if(readerThread)
>>        {
>>            tmp._start();
>>        }
>>      .....
>>        __input = new BufferedInputStream(tmp);
>>        __output = new ToNetASCIIOutputStream(new 
>>    }
>>We could make this configurable in some way if necessary.
>>Daniel Wikman wrote:
>>>Hi all!
>>>I wonder if someone has seen this and know a "cure" for this behaviour. I 
>>>wrote a program based on the TelnetClient class. When using 
>>>the program towards a Unix or Linux box directly everything works fine, 
>>>but when using telnet towards a serial blackbox, I always get an extra 
>>>newline added when writing commands (it seems like TelnetClient or the 
>>>underlying stream makes line terminations a la windows... The fun part is 
>>>that if I make my own TelnetClient program based on 
>>>Java.util.ProcessBuilder it works just fine. I'd really like to make my 
>>>program independent of the "/usr/bin/telnet" to make it work on windows 
>>>platform as well. Does anyone know what option that controls this in 
>>To unsubscribe, e-mail:
>>For additional commands, e-mail:
>Facklor och eldar i trädgården
>To unsubscribe, e-mail:
>For additional commands, e-mail:

Fynda charter till solen

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

View raw message