Program.cs 896 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using System;
  2. using System.Net;
  3. using System.Threading;
  4. namespace Benchmarks
  5. {
  6. public static class Program
  7. {
  8. private static readonly ManualResetEvent _WaitEvent = new ManualResetEvent(false);
  9. public static int Main(string[] args)
  10. {
  11. var server = new HttpBenchmarkServer(IPAddress.Any, 8080);
  12. try
  13. {
  14. AppDomain.CurrentDomain.ProcessExit += (_, __) =>
  15. {
  16. _WaitEvent.Set();
  17. };
  18. server.Start();
  19. _WaitEvent.WaitOne();
  20. return 0;
  21. }
  22. catch (Exception e)
  23. {
  24. Console.WriteLine(e);
  25. return -1;
  26. }
  27. finally
  28. {
  29. server.Stop();
  30. }
  31. }
  32. }
  33. }