How to increase connections on httpwebrequest c#

I've been playing with C#, and made a Multi-threaded application that would scrape a page from a certain site. I set 4 threads to scrape the address it worked perfectly on Windows XP, but noticed in Windows Vista Windows 7, it is only 2 threads at maximum the rest are in waiting state.

I've search on how to do it on the web but most suggested to modify the registry.
I explored MSDN and found a way to do it in code

System.Net.ServicePointManager.DefaultConnectionLimit = 4;


This simple line worked perfectly on Windows 7 and Vista

Leave a Reply

Proudly powered by Blogger
Theme: Esquire by Matthew Buchanan.
Converted by LiteThemes.com.