public Task <long> GetCurrentPing(string domainToPing = "8.8.8.8", int timeoutInMs = 500) { Task <PingReply> pingTask = new Ping().SendPingAsync(domainToPing, timeoutInMs); AssertV2.IsNotNull(pingTask, "ping"); return(pingTask.ContinueWith(finishedPingTask => { var pingReply = finishedPingTask.Result; AssertV2.IsNotNull(pingReply, "result"); return pingReply.RoundtripTime; })); // return ping in MS }