Hi all,

I have been struggling with a strange problem regarding ServletInputStream.
I am trying to read binary data from a JSP request from an applet that has
sent me some data.  I call request.getInputStream(), and then read the data
using the read(byte[], int, int) method.  For my test case, I am reading
about 4800 bytes.

Every once in awhile, I am getting a java.io.IOException in the client
applet when it is calling close() on the OutputStream it's using to send the
data.  It happens maybe one out of every 5 times.  I don't know if this is
relevant, but the message in the IOException I am getting in the client is:
        "localhost:8080//myapp/Upload.jsp"
even though it correctly connects to:
        "http://localhost:8080/myapp/Upload.jsp"

Perhaps it's just formatting the message incorrectly?

What is leading me to believe this is a timing issue is the following:

1) There are otherwise no differences between the times it works and the
times it doesn't.

2) This never happens when I put a breakpoint in my Servlet code.

3) If I put a Thread.sleep(100), the problem goes away.  (Obviously this is
a terrible hack...)

There don't appear to be any exceptions thrown in the Servlet, at least not
that I can tell.

I am using Tomcat 3.2.1, and debugging with JBuilder 4 Enterprise on Windows
2000.  I've tried searching the archives for any discussion on known
problems with ServletInputStream, and have found nothing.

Am I missing something fundamental?

Thanks a bunch!
-Jason-

winmail.dat

Reply via email to