On Fri, 11 Jan 2008 13:06:26 -0800, Rymfax <cw*****@bigbangllc.comwrote:
[...]
It is possible that it is reading zero bytes because the connection is
closing prematurely, but this is suppose to generate an exception
That's not true. You'll get an exception if the connection is _reset_,
but if it's simply closed then you get a 0 byte receive.
which I check for (I actually check for any exception).
So I don't
know what could be causing the ResponseStream to return zero bytes if
it hasn't reached the end of the content (according to the
ContentLength anyway).
As I said, there is no network requirement that the number of bytes
delivered by the server before closing the connection is identical to the
number of bytes the server advertised in the HTTP response. The
advertised length is just that: an advertisement. The network side of
things doesn't enforce it.
One would expect a correctly-behaving HTTP server to provide the bytes as
advertised, but servers don't always behave, and on top of that some ISPs
are known to mess with TCP connections, including doing something like
closing it for no good reason.
I've already coded in a re-check for when this
happens, but I was hoping to figure out WHY it is happening.
That's an admirably goal. But the only way you can do that is by doing
some debugging. You need to monitor the network traffic at both ends and
figure out who is closing the connection. Once you've identified that,
then you can look at why. Unfortunately, a vague problem description is
not enough information for anyone else in this newsgroup to answer the
question. Only first-hand knowledge will do.
Pete