Ping Modeller

Ping Modeller is a useful tool which allows the user to test the strength of their internet connection to any defined host, for any purpose required. For example, to be able to participate fully in any online multiplayer game, the user's connection needs to be of a certain strength to avoid lag-related issues; this short script allows the user to check how strong their connection will be beforehand, avoiding frustration upon discovery in-game. It also gives the user an idea of how easily they will be able to connect to a streaming website for example, provided they understand how “ping” is relevant to their connection.

Ping Modeller

Essenstially, the measure of the connection can be gathered by “pinging” a host URL, which means sending arbitrary data packets to it, measuring the time between their departure and return in milliseconds. The user ideally wants this to be as low as possible, as 0ms would theoretically be an instantaneous connection.

Ping Modeller

This script allows the user to input a host URL (in the left example, google.com)along with a time interval over which to ping the host, after which it returns a graph of the varying ping time (in ms) against the time interval, along with plotted lines signifying the mean average ping and one standard deviation.

Ping Modeller
This program is implemented in an iPython Jupyter Notebook, importing subprocess, matplotlib, NumPy and time. It defines a function, ping, which uses subprocess to ping the input host address, then stringifies and slices the returned data to output the ping time. Following this, the defined function pingmodel uses ping in a while loop in conjunction with time to append arrays with time and ping values over the input time interval. A graph is then plotted using the arrays.

A check is included by means of if statement, wherein if, after a quarter of the alotted time has passed (or 10 seconds, which ever is shorter) and no packets have returned (i.e. the ping array is filled with None values), the loop breaks and the user is asked if the input host address is correct. This is likely to be the error, unless the connection is so slow that the packets do not return.


Click the image below to download PingModeller:


Download PingModeller

Last updated: 15/08/2020

Ping Modeller Ping Modeller Ping Modeller