Command Line Packet Loss Test
This site was created as an easy way for non-technically inclined people to have test for packet loss in their browsers. I believe it has greatly succeeded at that goal, but I have had some people ask me if there is an API or a command-line version of the Packet Loss Test™.
There is not an API nor a command-line version of this site as both defeat the goals I had in mind for the site. This site was built around the WebRTC protocol to test for packet loss in the browser where it was not possible before. WebRTC only exists in a browser environment. Outside of the constraints of a web browser, it is not hard to test for packet loss and there are already much better solutions for command-line or programmatic testing.
If you are writing a program and looking for an API to test packet loss, you are thinking about the problem all backwards as it does not require an API. You are trying to calculate something, not receive information from a server. It is easy to packet loss yourself using the language's built-in networking abilities. You just try to send packets and see how many make it back, optionally with a server also tracking how many made it there. This site is very easy to reimplement.
If you just prefer command-line interfaces or have some other reason for wanting a command-line method of testing for packet loss though, such methods do exist, no thanks to me. The most popular option is to use iPerf, a free, open-source, CLI network testing tool.
To test for packet loss in iPerf, first you must install it. You can either download an iPerf binary or install it with your preferred package manager via
sudo apt install iperf3 or
choco install iperf3 or whatever.
Next, you must select an iPerf server to test against. You can find a list of public servers on iPerf's website. In the future I may host this as part of Packet Loss Test, but I haven't had time to set this up yet.
Then, you can test packet loss against it with the command
iperf3 -u -c nl.iperf.014.fr -i 1 -p 10415 and voilà! You'll have your answer in 10 seconds (or a different length if the
-t option is set with a number of seconds).