Name: krC82822 Date: 09/30/2000
Classic VM (build 1.2.2_006, green threads, nojit)
I'm wrapping a BufferedInputStream around a Socket's input stream like:
InputStream in = new BufferedInputStream(socket.getInputStream());
Now, I can retrieve socket data (in fact, I mark and reset the stream without a
hitch. However, the LAST .read() will ALWAYS wait around 15 seconds before
returning and saying that there's no data left in the stream.
Not sure why the socket blocks like that, but setting timeouts and such does
not fix the problem.. So, this may be a problem with Linux sockets. However,
the problem can most easily be fixed in the BufferedInputStream's fill() method.
In BufferedInputStream, if the following line could be changed from:
int n = in.read(buf, pos, buf.length - pos);
to:
int n = (in.available()==0) ? 0 : in.read(buf, pos, buf.length - pos);
Then the problem would go away.
(Review ID: 110148)
======================================================================