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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!