- From: Chris <chris@surewould.com>
- Date: Fri, 13 Feb 1998 16:48:38 -0500
- To: www-talk@w3.org
I'm trying to write a mini-browser in Java. I can send out the HTTP request OK, but my code that receives the file doesn't know when to quit. It looks (roughly) like this: // [in = the input stream of the socket I create] // [outfile = the file to dump the response into] String line; while ((line = in.readLine()) != null) outfile.println(line); Pretty basic. But it doesn't always work. Sometimes it works, sometimes it hangs forever, waiting for the last read. It depends on the page, and it's consistent (if it hangs on a certain page, then it *always* hangs on that page). Reading in one character at a time is inconsistent also. Should I be reading the Content-Length value and using it, instead of this lazy 'read-until-you-tell-me-not-to' approach? Thanks, Chris
Received on Friday, 13 February 1998 16:47:37 UTC