A
Andreas Håkansson
Hello,
I'm using the WebRequest class to download a few files of a webserver. I
use
async io to fecth the data. My problem is that the first file works like a
charm, and
the second file loads about 99%. The problem is that i *know* that BeginRead
is
called for the second file (over and over again) but the callback is never
called for
the last few bytes (or the transfer complete where it returns zero bytes).
I've looked over and over again and I've made sure all the streams are
flushed and
closed for each of the files. If I download either of the files seperate
then it works
like a charm.
The code is a couple of hundred lines long so I won't paste any code, but
I'm hoping
someone things this sounds familiar and can offer some advice.
Basicly what I do it..
(1) Create a WebRequest to file
(2) Open a new filestream
(3) Call BeginRead
(4) The callback is called time after time
(5) If I recieve more then 0 bytes I write them to the file,
else I close BOTH the filestream and the response stream
(6) If I have more files to downloads I repeat from (1) else I'm done.
I can't see why things get stuck up all of a sudden.
//Andreas
I'm using the WebRequest class to download a few files of a webserver. I
use
async io to fecth the data. My problem is that the first file works like a
charm, and
the second file loads about 99%. The problem is that i *know* that BeginRead
is
called for the second file (over and over again) but the callback is never
called for
the last few bytes (or the transfer complete where it returns zero bytes).
I've looked over and over again and I've made sure all the streams are
flushed and
closed for each of the files. If I download either of the files seperate
then it works
like a charm.
The code is a couple of hundred lines long so I won't paste any code, but
I'm hoping
someone things this sounds familiar and can offer some advice.
Basicly what I do it..
(1) Create a WebRequest to file
(2) Open a new filestream
(3) Call BeginRead
(4) The callback is called time after time
(5) If I recieve more then 0 bytes I write them to the file,
else I close BOTH the filestream and the response stream
(6) If I have more files to downloads I repeat from (1) else I'm done.
I can't see why things get stuck up all of a sudden.
//Andreas