[Rxtx] Underlying input stream returned zero bytes
TEIXOEIRA at terra.es
TEIXOEIRA at terra.es
Fri Sep 22 02:34:01 MDT 2006
Many thanks, Trent. I wouldn't be able to find out about this behaviour unless, perhaps, reading rxtx sources.
One more question. Does setting timeout/threshold before or after getting the input stream make a difference?
Again, thanks.
----Mensaje original----
De: tjarvi at qbang.org
Recibido: 22/09/2006 2:45
Para: <TEIXOEIRA at terra.es>, "RXTX Developers and Users"<rxtx at qbang.org>
Asunto: Re: [Rxtx] Underlying input stream returned zero bytes
On Thu, 21 Sep 2006, TEIXOEIRA at terra.es wrote:
>
> Hi, there.
> I'm having difficulties reading a serial line with RXTX 2.1-7 on Windows XP, I can communicate through this serial line using
> HiperTerminal though.
> Also, I can't find any clues about this issue on the internet. Can anybody tell what might cause this exception while reading?
>
> Kind regards.
>
> java.io.IOException: Underlying input stream returned zero bytes
> at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:415)
> at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453)
> at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183)
> at java.io.InputStreamReader.read(InputStreamReader.java:167)
> at java.io.BufferedReader.fill(BufferedReader.java:136)
> at java.io.BufferedReader.readLine(BufferedReader.java:299)
> at java.io.BufferedReader.readLine(BufferedReader.java:362)
>
>
>
> Prueba el correo Terra ( http://www.terra.es/correo ); Seguro, rápido, fiable.
>
>
Hello,
It is perfectly normal for rxtx to return zero bytes depending upon how
the timeout and threshold are set. If you do not want the read to
timeout, set it to zero.
*timeout threshold Behavior
*------------------------------------------------------------------------
*0 0 blocks until 1 byte is available timeout > 0,
* threshold = 0, blocks until timeout occurs, returns -1
* on timeout
*>0 >0 blocks until timeout, returns - 1 on timeout, magnitude
* of threshold doesn't play a role.
*0 >0 Blocks until 1 byte, magnitude of threshold doesn't
* play a role
I do not think defaults are documented so do not assume that they are the
same between rxtx and sun.
--
Trent Jarvi
tjarvi at qbang.org
Prueba el correo Terra ( http://www.terra.es/correo ); Seguro, rápido, fiable.
More information about the Rxtx
mailing list