commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Wikman" <dannewik...@hotmail.com>
Subject Re: TelnetClient problem?
Date Sat, 09 Dec 2006 16:04:07 GMT

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...


BR

/Daniel

>From: Rory Winston <rwinston@eircom.net>
>Reply-To: "Jakarta Commons Users List" <commons-user@jakarta.apache.org>
>To: Jakarta Commons Users List <commons-user@jakarta.apache.org>,  
>dannewikman@hotmail.com
>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));
>
>with
>
>__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 
>TelnetOutputStream(this));
>    }
>
>We could make this configurable in some way if necessary.
>Rory
>
>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 commons.net 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 
>>TelnetClient?
>>
>>BR
>>
>>/Daniel
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>

_________________________________________________________________
Facklor och eldar i trädgården http://alltombostad.msn.se/


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message