hi!
i'm programming an application, which relies on downloading stuff from the i-net.
either
Code:
new WebClient().DownloadString("http://.....")
or this version of it
Code:
static private string Download(string url)
{
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Method = "GET";
WebResponse respon = req.GetResponse();
Stream res = respon.GetResponseStream();
string ret = "";
byte[] buffer = new byte[1024];
int read = 0;
while ((read = res.Read(buffer, 0, buffer.Length)) > 0)
{
ret += Encoding.ASCII.GetString(buffer, 0, read);
}
return ret;
}
are causing a timeout exception after a minute of application hang. looking at it in wireshark, you see that no request has been submitted. the trick is: this bug appears sporadically every 3-4 times downloading something.
plz help me