Question
Objective: Write a python script that collects ping latency. Script Command: python pinger.py Command Description: To launch the script file (pinger.py), we give the script
Objective:
Write a python script that collects ping latency.
Script Command:
python pinger.py
Command Description: To launch the script file (pinger.py), we give the script the 2 arguments, the address and the number of pings to collect:
address: A string of the address to ping.
pings_to_collect: An integer of how many pings we want the script to collect data for. Each ping is separated by one second.
Ex. Input:
To ping google 120 times: python pinger.py google.com 120
Script Output:
Format:
Clock_Time: The system's clock time. The format should be hour:minute:second
Ping_in_ms: The result of the ping, only in milliseconds (as an integer). If the ping fails, report the value as -1.
Ex. Output:
13:01:40,54
13:01:41,60
13:01:42,-1
13:01:43,61
Notes:
The ping call will fail sometimes. Do not assume a ping response will returned within a second. So in your ping loop, wait until a response is returned (either with a ping or timeout) before waiting a second to start the next loop iteration.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started