Hi,
I need to do about 100 WebClient.DownloadString("xxxxx") as fast as
possible.
Threading is not my strongest side, so I ask for your help.
What is best practice in MT for doing 100 webrequest as fast as possible?
My idea was something like (I haven't tested it)...
private void StartWebRequets () {
for (int i = 0; i < 100; i++) {
ThreadPool.QueueUserWorkItem(DoQueryWeb, i);
}
}
private void DoQueryWeb(object state) {
int i = state as int;
WebClient client = new WebClient();
string html = client.DownloadString("my url");
InvokeOnMainThread(delegate {
// Do main thread stuff here
});
}
My worries is that firing 100 webrequests will kill the app. How would you
solve it? Can I tell ThreadPool to only do like 3-4 at a time?
Thanks!!
Mojo
--
View this message in context:
http://monotouch.2284126.n4.nabble.com/Threading-best-practice-tp4411605p4411605.html
Sent from the MonoTouch mailing list archive at Nabble.com.
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch