Throughput Test · Latency Test over UDP

Test peer

A test peer is a small program you run yourself on a computer on the same network as your iPhone or iPad. It answers Linkalyst’s own test protocol, so the two ends can measure the link between them.

It is not an Internet speed service, and not iperf or another existing tool. A website or an ordinary TCP service cannot answer that protocol.

Which tools need one

Throughput Test
throughput_peer.py · TCP 5202
Latency Test in UDP mode
echo_peer.py · UDP 9999

These are the default ports, and either can be changed when you start a peer. Every other tool, and the Latency Test in ping mode, works without a test peer.

Download

Each peer is a single Python file that uses only the standard library. The computer needs Python 3.9 or later, and nothing else. On a Mac without Python, the first python3 command offers to install Apple’s command line developer tools, which include it.

throughput_peer.py 4.8 KB

For the Throughput Test. Sends or receives synthetic data over one TCP connection.

SHA-256
6f3cf1a7bb8b076d8df0ddf77eb642cb8bdfc4a626e470b0231a8e2bd1d9643c
Download

echo_peer.py 7.8 KB

For the Latency Test in UDP mode. Echoes the packets that carry its access code.

SHA-256
d92e20436907a11897c9b14086360d9a4d92586c8c05250d5398e19a6bebfab4
Download

To check a download, compare the SHA-256 above with the output of shasum -a 256 echo_peer.py on macOS or Linux, or certutil -hashfile echo_peer.py SHA256 on Windows.

Both programs are provided as is, under section 5 of the Terms of Service.

Before you run one

  • Run a peer on a private network only. Both send plain text and neither is encrypted, and the throughput peer has no access code at all. Do not forward their ports from the Internet.
  • A peer listens only on the computer itself (127.0.0.1) until you give it an address, so your phone cannot reach it until you do. The UDP peer refuses public and wildcard addresses, and answers only packets from private addresses.
  • The throughput peer sends and receives synthetic data. It does not read files, keep what it receives, or forward anything.
  • Start the peer on the address of the interface you want to measure. A computer on a wired connection keeps a second wireless hop out of the result.

Run it

  1. 01

    Find the computer’s address

    Use the IP address of the interface on the same network as your phone.

    macOS · Wi-Fi is usually en0
    ipconfig getifaddr en0
    Windows · look for “IPv4 Address”
    ipconfig
    Linux
    hostname -I
  2. 02

    Start the peer on that address

    Open a terminal in the folder where you saved the file. The examples use 192.168.1.20; replace it with your computer’s address. On Windows, type py instead of python3.

    Throughput Test
    python3 throughput_peer.py --host 192.168.1.20
    Output
    Listening on 192.168.1.20:5202 (single connection; 64 MiB / 60 s maximum)
    Latency Test over UDP
    python3 echo_peer.py --bind 192.168.1.20
    Output
    Linkalyst UDP echo peer: 192.168.1.20:9999
    Access code: 3f9c2a61d04b7e85
    Private networks only. Do not forward this port from the Internet; the access code is not encryption. Press Ctrl+C to stop.
  3. 03

    Allow incoming connections

    If a firewall asks whether Python may accept incoming connections, allow it on the private network. There is no need to turn the firewall off.

  4. 04

    Enter the address in Linkalyst

    For the Throughput Test, enter the address and port the peer printed under Test Peer. For the Latency Test in UDP mode, add a UDP target with that address and port, and enter the 16-character access code the UDP peer printed.

  5. 05

    Keep the computer awake, then stop the peer

    The computer has to stay awake for the length of the test; on a Mac, starting the peer with caffeinate -i python3 … prevents idle sleep. Press Ctrl+C to stop the peer when you are done.

Options

throughput_peer.py

--host ADDRESSNumeric address to listen on. Default 127.0.0.1, which only the computer itself can reach.
--port PORTTCP port. Default 5202.
--onceExit after one connection.

echo_peer.py

--bind ADDRESSPrivate, loopback or link-local numeric address to listen on. Default 127.0.0.1.
--port PORTUDP port. Default 9999.
--token CODEUse this 16-character access code instead of a random one.

Run either file with --help for the full list. The UDP peer’s fault-injection options, such as --drop-every, are for testing Linkalyst itself and make results unrepresentative.

If the app cannot reach the peer

Every request times out, or the connection fails

Check that the phone and the computer are on the same network, and not on a guest network that keeps devices apart; that the address in the app is the one the peer printed; and that the firewall allows Python.

The UDP peer exits with --bind must be a numeric private/loopback/link-local address

Give it a private IPv4 or IPv6 address that belongs to the computer, written as numbers. Host names, 0.0.0.0 and public addresses are refused.

Address already in use

Another peer or program is using the port. Stop it, or start the peer with --port and enter the same port in the app.

The UDP peer is running but nothing comes back

Check the access code. The peer ignores packets without the code it printed, and the app keeps the code only while it is running, so enter it again after the app has been closed.