A Python Ping Tester

We have been having a lot of short network dropouts lately, something that is rather troubling when playing online games.

The GUI for a little ping tester tracking the stability of our household internet.
The GUI for a little ping tester tracking the stability of our household internet.
I was wondering just how prevalent the issue is, just how good or bad is the service at any given moment. I know I can download any number of network testing utilities, but what is the fun in that? Maybe just write something!

The little app is a Python/Tk gui. It simply pings an IP address and plots the results. The program is nothing serious, but it does the job. I have included the Python code below, a simple example of a Tk GUI.

NetCheck.py

The code is written for Python 3.5 or better as it uses the subprocess.run() method that was introduced with 3.5. This method just makes getting the stdio output so much easier. There are native ping libraries available for Python, they do require running the script in administrator to allow low level socket use. By using a subprocess I avoid that, if not quite as neat a solution.

Any IP address can be pinged, I am currently using 8.8.8.8 which is a Google DNS server. Using this server pretty much guarantees the issue is the local network, not an issue at the server end.

The results? Our local net is not looking too bad. There are periods when a cluster of dropouts occur, each lasting a minute or two. You can see one of these on the screen cap above. Fortunately these are unusual and not the norm… At least so far. I may update that evaluation when I get more data.