Lightweight LAN throughput & latency testing from the terminal.
LANSpeed is a lightweight, Python-based network diagnostic tool for measuring latency, download throughput, and upload throughput between devices on the same local network.
It uses a small TCP client/server architecture and focuses on being simple, transparent, portable, and easy to integrate into scripts or other tools.
π Built with Python's standard library β no external runtime dependencies are required.
- π TCP client/server architecture
- π‘ LAN latency measurement
- β¬οΈ Download throughput testing
- β¬οΈ Upload throughput testing
- π Explicit TCP message framing
- βοΈ Configurable host, port, duration, chunk size, and timeout
- π§Ύ JSON output for automation
- π¦ PyInstaller-compatible standalone client
- π Python standard library
- πͺ Windows support
- π§ Linux support
- π» Simple terminal-based interface
- π‘οΈ Input and transfer-size validation
- π§© Modular client, server, protocol, and metrics architecture
LANSpeed uses a simple client/server architecture.
The server listens for incoming TCP connections, while the client connects to the server and performs the requested network measurements.
LAN / Local Network
βββββββββββββββββββββββββββ
β LAN Client β
β β
β β’ Connect β
β β’ Measure latency β
β β’ Download test β
β β’ Upload test β
β β’ Calculate metrics β
ββββββββββββββ¬βββββββββββββ
β
β TCP :8765
β
βΌ
βββββββββββββββββββββββββββ
β LAN Server β
β β
β β’ Accept connections β
β β’ Respond to requests β
β β’ Send test data β
β β’ Receive test data β
β β’ Validate protocol β
βββββββββββββββββββββββββββ
A complete speed test follows this general flow:
Client Server
β β
βββββββββββ HELLO βββββββββββββ>β
β<βββββββββ OK ββββββββββββββββββ
β β
βββββββββ LATENCY βββββββββββββ>β
β<βββββββββ OK ββββββββββββββββββ
β β
βββββββββ DOWNLOAD ββββββββββββ>β
β<βββββββββ DATA ββββββββββββββββ
β<βββββββββ DATA ββββββββββββββββ
β<βββββββββ END βββββββββββββββββ
β β
ββββββββββ UPLOAD βββββββββββββ>β
ββββββββββ DATA βββββββββββββββ>β
ββββββββββ DATA βββββββββββββββ>β
ββββββββββ END ββββββββββββββββ>β
β<βββββββββ DONE ββββββββββββββββ
LANSpeed is intended primarily for local networks and authorized testing environments.
LANSpeed does not rely on TCP recv() calls corresponding to complete application messages.
Instead, application-level messages use explicit framing.
Control messages use a 4-byte big-endian length prefix followed by the message payload:
ββββββββββββββββ¬ββββββββββββββββββββββββββ
β 4-byte size β JSON control message β
ββββββββββββββββ΄ββββββββββββββββββββββββββ
Upload and download data use the same length-prefixed approach:
ββββββββββββββββ¬ββββββββββββββββββββββββββ
β 4-byte size β Transfer chunk β
ββββββββββββββββ΄ββββββββββββββββββββββββββ
A zero-length frame marks the end of a transfer:
ββββββββββββββββ
β 0x00000000 β
ββββββββββββββββ
This explicit framing allows LANSpeed to correctly handle:
- Partial TCP reads
- Multiple messages received together
- Large transfers
- Transfer boundaries
- Unexpected or malformed input
TCP is a byte stream, not a message-oriented protocol.
LANSpeed requires:
- Python 3.9 or newer
- Two devices connected to the same LAN
- Network connectivity between the devices
- Firewall access to the LANSpeed server port
The default server listener is:
0.0.0.0:8765
This means the server listens on all available network interfaces on TCP port 8765.
| Platform | Status |
|---|---|
| Windows | β |
| Linux | β |
| macOS | |
| Other Unix-like systems |
The core networking code uses Python's standard library and should remain portable, although platform-specific testing may vary.
git clone https://github.com/ItsWanheda/lanspeed.git
cd lanspeedpy -m pip install -e .py -m lan_speed_tester --helpYou can also run LANSpeed directly from the source tree during development.
On the machine you want to test against:
py -m lan_speed_tester serverThe server should display:
LANSpeed server listening on 0.0.0.0:8765
Press Ctrl+C to stop.
Leave the server running.
The client needs the LAN IP address of the machine running the server.
Open PowerShell or Command Prompt:
ipconfigLook for the active network adapter:
Wireless LAN adapter Wi-Fi:
IPv4 Address. . . . . . . . . . : 192.168.1.34
In this example:
Server: 192.168.1.34
Run:
ip addror:
hostname -ILook for an address such as:
192.168.1.34
Common private IPv4 ranges include:
192.168.x.x
10.x.x.x
172.16.x.x - 172.31.x.x
Do not use:
127.0.0.1
when the client and server are running on different machines.
127.0.0.1 refers to the local machine itself.
From another device on the same LAN:
py -m lan_speed_tester test 192.168.1.34Replace 192.168.1.34 with your server's LAN IP.
The test performs:
Latency
β
βΌ
Download
β
βΌ
Upload
β
βΌ
Results
You can also run individual measurements.
py -m lan_speed_tester ping 192.168.1.34Measures the response time between the client and server.
py -m lan_speed_tester download 192.168.1.34Measures how quickly the client can receive data from the server.
py -m lan_speed_tester upload 192.168.1.34Measures how quickly the client can send data to the server.
LANSpeed supports machine-readable JSON output for automation, scripts, monitoring systems, and data processing.
Run:
py -m lan_speed_tester test 192.168.1.34 --jsonExample structure:
{
"host": "192.168.1.34",
"port": 8765,
"latency": {},
"download": {},
"upload": {}
}The exact fields may evolve as the metrics system develops.
JSON output is designed to make LANSpeed easy to integrate into:
- Shell scripts
- Python scripts
- Monitoring systems
- CI environments
- Network diagnostics
- Custom dashboards
- Automated testing
LANSpeed provides configurable parameters for network testing.
Depending on the command, these may include:
| Parameter | Purpose |
|---|---|
| Host | Server IP address or hostname |
| Port | TCP server port |
| Duration | Length of throughput tests |
| Chunk size | Size of individual transfer chunks |
| Timeout | Socket communication timeout |
8765
0.0.0.0:8765
Configuration defaults are intentionally conservative and can be adjusted as the project evolves.
LANSpeed separates network communication from metric calculation.
The metrics layer is responsible for processing measurements such as:
Latency β response time between client and server
Throughput = transferred data / elapsed time
Results can be represented in human-readable units or JSON for automation.
The goal is to keep measurement logic independent from the terminal interface and network protocol.
Clone and install the project:
py -m pip install -e .Run the test suite:
py -m unittest discover -s tests -vIf the project test configuration provides pytest support:
py -m pytestCheck the core modules:
py -m py_compile src\lan_speed_tester\protocol.py
py -m py_compile src\lan_speed_tester\client.py
py -m py_compile src\lan_speed_tester\server.py
py -m py_compile src\lan_speed_tester\cli.py
py -m py_compile src\lan_speed_tester\metrics.pylanspeed/
β
βββ src/
β βββ lan_speed_tester/
β βββ __init__.py
β βββ __main__.py
β βββ cli.py
β βββ client.py
β βββ server.py
β βββ protocol.py
β βββ metrics.py
β
βββ tests/
β βββ test_cli.py
β βββ test_package.py
β
βββ launcher.py
βββ pyproject.toml
βββ README.md
βββ CHANGELOG.md
βββ SECURITY.md
βββ CONTRIBUTING.md
βββ CODE_OF_CONDUCT.md
βββ LICENSE
βββ .gitignore
LANSpeed can be packaged as a standalone Windows executable using PyInstaller.
The project provides:
launcher.py
Build the standalone client:
py -m PyInstaller --clean --onefile --name lanspeed-client --paths src launcher.pyThe resulting executable will be:
dist/
βββ lanspeed-client.exe
Run it with:
.\dist\lanspeed-client.exe test 192.168.1.34The standalone build is useful when running the client on a machine where you do not want to install the complete Python development environment.
If the client cannot connect to the server:
- Make sure the LANSpeed server is running.
- Verify the server IP address.
- Verify that port
8765is accessible. - Check the Windows/Linux firewall.
- Make sure both machines are on the same LAN.
- Make sure you are not using
127.0.0.1from another device.
A timeout can indicate:
- Firewall filtering
- Incorrect IP address
- Network isolation
- Server not running
- Unstable network connectivity
- Incorrect port configuration
Make sure the client and server are running compatible versions of LANSpeed.
Protocol changes should always be tested on both sides.
Some Wi-Fi networks prevent connected devices from communicating with each other.
This can occur with:
- Guest Wi-Fi
- Client isolation
- AP isolation
- VLAN segmentation
- Router firewall rules
If two devices can access the Internet but cannot communicate directly, check the router or access-point configuration.
- Project foundation
- Python package configuration
- TCP client/server architecture
- TCP latency measurement
- Download throughput testing
- Upload throughput testing
- Explicit TCP transfer framing
- Configurable test duration
- Configurable transfer chunk size
- JSON output
- PyInstaller client build
- Security and contribution documentation
- Rich terminal output
- Improved JSON/CSV export
- UDP packet-loss testing
- Jitter measurement
- Multi-stream throughput
- Network interface discovery
- Historical test results
- More detailed network statistics
- Automated test reporting
- Expanded protocol test coverage
- Improved cross-platform packaging
The roadmap is subject to change as LANSpeed develops.
LANSpeed is a network performance testing utility, not an authentication system or security boundary.
The server accepts network connections and should therefore only be exposed to networks and systems you are authorized to test.
For security guidance and vulnerability reporting, see:
Please only use LANSpeed against systems and networks where you have permission to perform testing.
Contributions are welcome!
Before submitting changes, please read:
For community standards and expected behavior:
Bug reports, documentation improvements, testing, protocol improvements, performance work, and new features are all welcome.
Development history and notable releases are documented in:
LANSpeed is released under the MIT License.
See LICENSE for the complete license text.