I’ve written a program that opens a site to read with WebClient.OpenRead every 30 seconds.
but after 1 or 2 times, it can’t continue doing that and throws an exception of timeout.
What’s wrong here?
I’ve written a program that opens a site to read with WebClient.OpenRead every 30
Share
Hmm… My intuition says:
Do you dispose of the stream correctly too? If you don’t, the stream will likely remain open, causing the server’s resource limits (2 connections per client, for instance), to hit you.
Using an
usingconstruct will dispose of the stream automatically for you.