(Oct-28-2022, 11:27 PM)Skaperen Wrote: now try calling something in some Python3 code and capturing each ping response and output the time since the previous response (beginning of command for first response). the unit of delta time can be in milliseconds. at the end give the delta stats: lowest, median, average, highest
icmplib(The best Python implementation
ICMP protocol) will give timings of diffrent ping times used.
from icmplib import ping
host = ping('python-forum.io', count=4)
print(host)
Output:
104.21.27.41
------------------------------------------------------------
Packets sent: 4
Packets received: 4
Packet loss: 0.0%
Round-trip times: 24.0 ms / 29.25 ms / 33.0 ms
Jitter: 5.0 ms
----------------------------------------------------------
# min, avg, max, jitter(variance of the latency of packets flowing through the network)
>>> host.min_rtt
29.0
>>> host.avg_rtt
32.0
>>> host.max_rtt
35.0
>>> host.jitter
5.333