You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Andrew Kolbus <an...@gmail.com> on 2014/12/09 03:15:48 UTC

Help putting TelnetClient into binary mode?

I am using the TelnetClient from commons-net 3.3 in JDK 8.  When I try to
receive xmodem data over a telnet session, some bytes do not make it
through to my code.

Example:
The remote device sends this (confirmed using windows network monitor):
01 01 FE [...] C0 00 FF FF FF 00 00 00 00 27 27 00 [...] (133 byte
xmodem-crc packet)

However, from the telnet client, I get this:
01 01 FE [...] C0 00 FF 00 00 00 27 27 00 [...] (130 bytes total)

>From what I have read, this is related to NVT.  It looks like it is
converting [FF FF] to [FF] (removing one byte), and just outright removing
[FF 00] (removing another two bytes for a total of three).

I tried using telnetClient.addOptionHandler(new
SimpleOptionHandler(TelnetOption.BINARY, true, true, true, true));, but
that did not change the data I received.

A sample of the code I used to discover the issue is attached.  Is there a
way to get the TelnetClient to pass all data through?

Re: Help putting TelnetClient into binary mode?

Posted by Andrew Kolbus <an...@gmail.com>.
Sebb,
That's what I feared.  The remote device I'm connecting to doesn't add any
of the padding on 0xFF bytes, so it looks like I can't use the
TelnetClient.  Fortunately, for my needs a simple Socket connection should
work fine.

Thanks,
Andrew

On Tue, Dec 9, 2014 at 8:10 AM, sebb <se...@gmail.com> wrote:

> On 9 December 2014 at 02:15, Andrew Kolbus <an...@gmail.com>
> wrote:
> > I am using the TelnetClient from commons-net 3.3 in JDK 8.  When I try to
> > receive xmodem data over a telnet session, some bytes do not make it
> through
> > to my code.
> >
> > Example:
> > The remote device sends this (confirmed using windows network monitor):
> > 01 01 FE [...] C0 00 FF FF FF 00 00 00 00 27 27 00 [...] (133 byte
> > xmodem-crc packet)
> >
> > However, from the telnet client, I get this:
> > 01 01 FE [...] C0 00 FF 00 00 00 27 27 00 [...] (130 bytes total)
> >
> > From what I have read, this is related to NVT.  It looks like it is
> > converting [FF FF] to [FF] (removing one byte), and just outright
> removing
> > [FF 00] (removing another two bytes for a total of three).
>
> Yes, that is what the RFC mandates:
>
> https://tools.ietf.org/html/rfc856#section-5
>
> In binary mode, IAC (FF) is still required to be recognised.
>
> > I tried using telnetClient.addOptionHandler(new
> > SimpleOptionHandler(TelnetOption.BINARY, true, true, true, true));, but
> that
> > did not change the data I received.
> >
> > A sample of the code I used to discover the issue is attached.  Is there
> a
> > way to get the TelnetClient to pass all data through?
>
> No, that would violate the RFC.
>
> https://tools.ietf.org/html/rfc856#section-5
>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> > For additional commands, e-mail: user-help@commons.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

Re: Help putting TelnetClient into binary mode?

Posted by sebb <se...@gmail.com>.
On 9 December 2014 at 02:15, Andrew Kolbus <an...@gmail.com> wrote:
> I am using the TelnetClient from commons-net 3.3 in JDK 8.  When I try to
> receive xmodem data over a telnet session, some bytes do not make it through
> to my code.
>
> Example:
> The remote device sends this (confirmed using windows network monitor):
> 01 01 FE [...] C0 00 FF FF FF 00 00 00 00 27 27 00 [...] (133 byte
> xmodem-crc packet)
>
> However, from the telnet client, I get this:
> 01 01 FE [...] C0 00 FF 00 00 00 27 27 00 [...] (130 bytes total)
>
> From what I have read, this is related to NVT.  It looks like it is
> converting [FF FF] to [FF] (removing one byte), and just outright removing
> [FF 00] (removing another two bytes for a total of three).

Yes, that is what the RFC mandates:

https://tools.ietf.org/html/rfc856#section-5

In binary mode, IAC (FF) is still required to be recognised.

> I tried using telnetClient.addOptionHandler(new
> SimpleOptionHandler(TelnetOption.BINARY, true, true, true, true));, but that
> did not change the data I received.
>
> A sample of the code I used to discover the issue is attached.  Is there a
> way to get the TelnetClient to pass all data through?

No, that would violate the RFC.

https://tools.ietf.org/html/rfc856#section-5

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

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