Note that there are some explanatory texts on larger screens.

plurals
  1. POMultiple WebClients, Over time weclints stop working
    primarykey
    data
    text
    <p>first time poster, long time reader, so take it easy on me :)</p> <p>I'm writing an application that reads in a bunch of folders and allows you to download an image for each folder. There is a WebBrowser control where you can browse to a particular image, and click a button "use this image for the selected folder".</p> <p>Each "folder" is represented as an object with its own download method, which uses WebClient inside a BackgroundWorker Thread.</p> <p>When I set the image url on the object, it starts the backgroundworker of that object and runs this code</p> <pre><code> using (WebClient client = new WebClient()) { client.Proxy = null; Stream stream = client.OpenRead(BackdropUrl); Bitmap bitmap = new Bitmap(stream); stream.Flush(); stream.Close(); e.Result = bitmap; } </code></pre> <p>I also use a webclient in my applications main thread to do some simple html "scraping".</p> <p>Now, to the problem. When I start using the app, all is good, the files will download as I go through the list, but after a while, it seems that the webclients randomly become unresponsive. I can still browse around in the webbrowser control, but all the webclient execution code seems to not complete it just hangs at one of these two lines:</p> <pre><code>Stream stream = client.OpenRead(BackdropUrl); Bitmap bitmap = new Bitmap(stream); </code></pre> <p>I know this is still pretty vague, but I tried to explain it as best I could. Does anyone maybe have a more robust way to download an image straight into a Bitmap object? i.e. not saving to file then opening it again?</p> <p>Any help will be greatly appreciated.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload