I need to send about 200 HTTP requests in parallel to different servers and get response. I use HttpWebRequest class in C#. But I don\'t see good time enhancement when requests
you can try this :
try
{
List uris = new List();
uris.Add(new Uri("http://www.google.fr"));
uris.Add(new Uri("http://www.bing.com"));
Parallel.ForEach(uris, u =>
{
WebRequest webR = HttpWebRequest.Create(u);
HttpWebResponse webResponse = webR.GetResponse() as HttpWebResponse;
});
}
catch (AggregateException exc)
{
exc.InnerExceptions.ToList().ForEach(e =>
{
Console.WriteLine(e.Message);
});
}