[613] in java-interest

home help back first fref pref prev next nref lref last post

Re: serverInput.read blocking with 0 bytes to read...

daemon@ATHENA.MIT.EDU (Jonathan Payne)
Fri Jul 7 23:38:59 1995

Date: Thu, 6 Jul 1995 11:08:56 -0700
From: jpayne@starwave.com (Jonathan Payne)
To: java-interest@java.Eng.Sun.COM

I just said this in a different context.  available() always returns 0
for socket input streams.  I am surprised it blocks when you specify 0
bytes, however.  That's kinda weird.

> From: grover@ra.isisnet.com (Gary Joseph Bowdridge)
> Date: Thu, 6 Jul 1995 06:47:20 -0300 (ADT)
> Sender: owner-java-interest@java.sun.com
> Precedence: bulk
> X-Info: To unsubscribe, send 'unsubscribe' to java-interest-request@java.sun.com
> Content-Type: text
> Content-Length: 1070
> 
> ok.. Bare with me. I'm new to the ideas of OO. and new to Java..
> but catching on.
> 
> I open a new NetworkClient connection to a host  
>     client=new NetworkClient(telnethost,telnetport);
> 
> I check to see how much data is in the input stream
>       numthere=client.serverInput.available();
> 
> I proceed to read that data
>       client.serverInput.read(telnetline,0,numthere);
> 
> Now, i would assume that when "numthere" is "0" (as it seems to be often)
> client.serverInput.read would NOT block waiting to read "0" bytes from
> a stream with "0" bytes waiting to be read.. tho that seems to be the
> case.... If numthere=0 the applet hangs at the read...
> 
>   It was easily fixed by first checking to see if "numthere > 0" 
> before doing the read...   
> 
>   Am i doing something wrong with my read?
> 
> Better yet.. is there a NON-Blocking input/output stream implemented?
> i didn't seem to see anything of the sort (*new to java*).
> 
> ___
> grover@ra.isisnet.com (Gary Bowdridge).
> 
> -
> Note to Sun employees: this is an EXTERNAL mailing list!
> Info: send 'help' to java-interest-request@java.sun.com
> 

-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post