开发者

Call multiple HttpWebRequest

开发者 https://www.devze.com 2023-04-08 02:40 出处:网络
I need to开发者_开发技巧 do several HttpWebRequest requests in a single moment, but when I make the request several times will cost a lot of time. I plan on doing each request in a separate thread and

I need to开发者_开发技巧 do several HttpWebRequest requests in a single moment, but when I make the request several times will cost a lot of time. I plan on doing each request in a separate thread and then get all the returns and put it all together when all calls are completed is it possible?


Absolutely.

Take a look at the msdn docs on HttpWebRequest.BeginGetResponse Method

I couldn't write a better example than in the docs.


I don't know much about Threading, but as they run asynchronously, getting a return value isn't an option. However, this thread : http://social.msdn.microsoft.com/Forums/en-US/csharplanguage/thread/c43c0cce-491a-4ddb-9012-69929fab8e5e/ does point towards the ThreadPool class.

0

精彩评论

暂无评论...
验证码 换一张
取 消