WebClient Timed Out after 10 minutes
Hi,
I run a program with 20 threads getting data from web.
After about 10 minutes I keep getting operation timed out exception.
If I restart the program it works again for 10 minutes.
Looks like there is a memory leak or something.
Some says that webclient uses webrequest object somewhere. I do not see it in watch though.
Also some says that max connection can happen. How to prevent that?
Re: WebClient Timed Out after 10 minutes
How does your program retrieve information? Does it increment a counter? Are the parameters you are passing to the web application (if any) out of the valid range? Does the website have an anti-DoS-attack functionality that rejects connections if too many have come from the same place in a short period of time?
Re: WebClient Timed Out after 10 minutes
I believe the issue is that if loading fail I would terminate the thread. Webclient, uses webrequest inside. I think in webrequest you need to close connection or something.
I do not think the site is an issue because ending the program and restarting it will work.
Re: WebClient Timed Out after 10 minutes
Re: WebClient Timed Out after 10 minutes
vb.net Code:
Try
theEnchancedWinClient.WebClient = New System.Net.WebClient
System.Diagnostics.Debug.Print("Grab URL " + theEnchancedWinClient.PackedScannable)
.Result = theEnchancedWinClient.WebClient.DownloadString(theEnchancedWinClient.PackedScannable)
System.Diagnostics.Debug.Print("Finish Grabbing URL " + theEnchancedWinClient.PackedScannable)
Catch ex As Exception
System.Diagnostics.Debug.Print("Failure to load")
theEnchancedWinClient.Thread.Abort()
End Try
Re: WebClient Timed Out after 10 minutes
First of all, try only using one WebClient (for all threads or per thread). That would definitely save on memory.
What is the value of PackedScannable?
Re: WebClient Timed Out after 10 minutes
The URL. I used to use only one webclient. I changed that thinking it'll work better.
Re: WebClient Timed Out after 10 minutes
I know the value of PackedScannable is the URL, what is the URL?