c# - Ping timeout is unpredictable -
i have faced strange ping timeout behavior.
var sw = new stopwatch(); var options = new pingoptions(128, true); sw.start(); pingreply reply = pingsender.send(device.ip, timeout, buffer, options); sw.stop(); logger.log.info("ping time = " + sw.elapsedmilliseconds); if (reply.status == ipstatus.success) { ping.add(reply.roundtriptime > 0 ? reply.roundtriptime : 1); } i set timeout 500 ms. reply.status == ipstatus.timedout, sw.elapsedmilliseconds == 50 ms.
i set timeout 10 ms. , reply.status == ipstatus.success, sw.elapsedmilliseconds == 60 ms.
why works strange?
Comments
Post a Comment