Advertisement
Guest User

Untitled

a guest
Jul 1st, 2015
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. class Program
  2. {
  3. public static void Main(string[] args)
  4. {
  5. Console.WriteLine("Hello World!");
  6.  
  7. // TODO: Implement Functionality Here
  8. Test(250);
  9. Test(500);
  10. Test(1000);
  11. Test(1500);
  12. Test(2000);
  13. Test(10000);
  14. Test(20000);
  15. Test(30000);
  16. Test(50000);
  17. Test(100000);
  18.  
  19. Console.Write("Press any key to continue . . . ");
  20. Console.ReadKey(true);
  21. }
  22.  
  23. static void Test (int size)
  24. {
  25. //string url = "http://127.0.0.1:9665/";
  26. string url = "http://192.168.1.47:9615/";
  27. int loop_count = size/10;
  28. for (int i=0; i<loop_count; i++)
  29. {
  30. url = url + "ABCDE12345";
  31. }
  32.  
  33. Console.WriteLine("URL Request Length:" + url.Length);
  34.  
  35. try
  36. {
  37. HttpWebRequest webrequest = (HttpWebRequest) WebRequest.Create(url);
  38. webrequest.KeepAlive = false;
  39.  
  40. HttpWebResponse webresponse;
  41. webresponse = (HttpWebResponse)webrequest.GetResponse();
  42.  
  43. Encoding enc = System.Text.Encoding.GetEncoding(1252);
  44. StreamReader loResponseStream = new StreamReader(webresponse.GetResponseStream(),enc);
  45. string Response = loResponseStream.ReadToEnd();
  46. Console.WriteLine(Response);
  47. }
  48. catch (Exception ex)
  49. {
  50. Console.WriteLine("Excetion: {0} stack: {1}", ex.Message, ex.StackTrace);
  51. }
  52. }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement