Well I have a multi-threaded program which downloads URL sources from the web. Im doing this multiple times at once. The only problem I see is that sometimes it takes a while to download the source
and only one webresponse can happen at once because the rest of the threads seem to wait on the first webresponse to finish. Is there a way around this? I hope you understand what my problem is.
Code:
WebResponse ServerResponse = webrequest.GetResponse();
Code:
public static void run() { string reply = ""; string link = ("http://www.google.com"); WebRequest webrequest = WebRequest.Create(link); try { WebResponse ServerResponse = webrequest.GetResponse(); StreamReader streamreader = new StreamReader(ServerResponse.GetResponseStream()); reply = streamreader.ReadToEnd(); ServerResponse.Close(); streamreader.Close(); } catch (Exception e) { MessageBox.Show(e.Message); } }
Comment