Hi Plater..
Thanks for replying..
The Response object is of type System.IO.Strea m. HttpWebResponse .GetResponseStr eam returns a type of Stream object, which doesnt has DataAvailable property :-(
I have found a workaround for this problem. Inside the loop, I check for bytesSize and if it = -1, i throw an IOException (assuming that network is down). I am testing this piece of code by pulling out the network cable from my system when...
User Profile
Collapse
-
code snippet
If there...Code:do { bytesSize = Response.Read(downBuffer, 0, downBuffer.Length); if (bytesSize > 0) { Local.Write(downBuffer, 0, bytesSize); if(!Response.CanRead) break; if (goPause == true) break; } } while (bytesSize > 0);Leave a comment:
-
HttpWebResponse doesnt throws error when network not available
I am using a HttpWebResponse object to download a file from remote location. The problem is that while going through a loop to download the file, if the network goes off, then the code doesnt throws any exception.
I checked in .Net framework 1.0 and 1.1 and the same problem persists. Though in 2.0, i get an IOException.
Can anyone throw some light on this? i am not sure if there is anything fishy about my code or is this a problem with...
No activity results to display
Show More
Leave a comment: