Пример #1
0
        public async Task StartPinging()
        {
            Logger = new RequestLogger();
            Logger.AddFailureWatch(this);

            Timer = new Stopwatch();
            Timer.Start();

            var pingTasks =
                RequestUris.Select(uri => new ServerPinger(uri.Uri, TimeSpan.Zero, Logger).BeginPinging(TokenSource.Token));
            // Tasks are running... now we just wait...
            var completeTask = Task.WhenAll(pingTasks);

            await completeTask;

            Timer.Stop();
        }
Пример #2
0
 public ServerPinger(Uri request, TimeSpan delay, RequestLogger log)
 {
     RequestUri = request;
     TimeDelay  = delay;
     Log        = log;
 }