public static void Test() { //var urls = new List<string>(); ////urls.Add("http://blogz.sohu.com/index/c13981.shtml"); ////urls.Add("http://www.cnblogs.com/kwklover/archive/2007/01/22/627173.html"); ////urls.Add("http://www.soxuan.com"); //urls.Add("http://www.google.com.hk/"); //urls.Add("http://www.cnblogs.com"); //urls.Add("http://www.miniclip.com/games/en/"); //urls.Add("http://www.baidu.com"); //urls.Add("http://www.360buy.com"); //foreach (string url in urls) //{ // HttpClient client=new HttpClient(url); // client.Timeout = 30000; // string html=client.Request(); // Console.Write(html); //} var test1 = new WaitForIdleExample(); var states = new List <string>(); states.Add("http://www.360buy.com/product/222701.html"); states.Add("http://www.360buy.com/product/682747.html"); states.Add("http://www.360buy.com/product/222704.html"); states.Add("http://www.360buy.com/product/222701.html"); states.Add("http://www.360buy.com/product/354444.html"); states.Add("http://www.360buy.com/product/352655.html"); states.Add("http://www.360buy.com/product/481284.html"); states.Add("http://www.360buy.com/product/563181.html"); states.Add("http://www.360buy.com/product/481245.html"); states.Add("http://www.360buy.com/product/673975.html"); System.Net.ServicePointManager.DefaultConnectionLimit = 500; Stopwatch sw = new Stopwatch(); sw.Start(); //test1.DoWork(states.ToArray()); //foreach (string state in states) //{ // test1.DoSomeWork(state); //} test1.DoWork(states.ToArray()); sw.Stop(); Console.Write(sw.ElapsedMilliseconds); Console.Read(); }
public static void Test() { //var urls = new List<string>(); ////urls.Add("http://blogz.sohu.com/index/c13981.shtml"); ////urls.Add("http://www.cnblogs.com/kwklover/archive/2007/01/22/627173.html"); ////urls.Add("http://www.soxuan.com"); //urls.Add("http://www.google.com.hk/"); //urls.Add("http://www.cnblogs.com"); //urls.Add("http://www.miniclip.com/games/en/"); //urls.Add("http://www.baidu.com"); //urls.Add("http://www.360buy.com"); //foreach (string url in urls) //{ // HttpClient client=new HttpClient(url); // client.Timeout = 30000; // string html=client.Request(); // Console.Write(html); //} var test1 = new WaitForIdleExample(); var states = new List<string>(); states.Add("http://www.360buy.com/product/222701.html"); states.Add("http://www.360buy.com/product/682747.html"); states.Add("http://www.360buy.com/product/222704.html"); states.Add("http://www.360buy.com/product/222701.html"); states.Add("http://www.360buy.com/product/354444.html"); states.Add("http://www.360buy.com/product/352655.html"); states.Add("http://www.360buy.com/product/481284.html"); states.Add("http://www.360buy.com/product/563181.html"); states.Add("http://www.360buy.com/product/481245.html"); states.Add("http://www.360buy.com/product/673975.html"); System.Net.ServicePointManager.DefaultConnectionLimit = 500; Stopwatch sw = new Stopwatch(); sw.Start(); //test1.DoWork(states.ToArray()); //foreach (string state in states) //{ // test1.DoSomeWork(state); //} test1.DoWork(states.ToArray()); sw.Stop(); Console.Write(sw.ElapsedMilliseconds); Console.Read(); }