my Code:
System.Net.HttpWebRequest req = (System.Net.HttpWebRequest)System.Net.WebRequest.Create("http://192.168.2.2/web/movielist");
req.Timeout = 2000;
System.Net.WebResponse res = req.GetResponse();
System.IO.Stream responseStream = res.GetResponseStream();
The requested document (movielist) is a very big document and it requires more than 10 seconds to retrieve it complete.
I want to only set a timeout for establishing the connection itself. As far as i can see req.Timeout is a timeout for the whole request not only establishing the connection. There should be no timeout for retrieving the document.
That timeout is in milliseconds - so 2000ms = only 2 seconds. You can't specify a connection establish timeout - the timeout is for the whole request. Try changing 2000 to 20000 (20 seconds) or higher to avoid timeouts.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With