WiFi Throughput Test

Hardware Isolation Guide

Why run a local server?

Traditional tests measure internet plan speed. This Hardware Isolation Test bypasses your ISP to measure the physical limit of your Wi-Fi router. It is the only way to verify if your hardware is performing at its limit.

The Python Script

Save this code as server.py on your computer.

server.py
import socket
import socket
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer

ONE_GB = 1_000_000_000

def get_all_lan_ips():
    """
    Returns a list of all potential LAN IPs, excluding loopback (127.x) 
    and APIPA/Link-Local (169.254.x).
    """
    ip_list = []
    try:
        hostname = socket.gethostname()
        for ip in socket.gethostbyname_ex(hostname)[2]:
            # Filter out localhost and auto-configured link-local IPs
            if not ip.startswith("127.") and not ip.startswith("169.254."):
                ip_list.append(ip)
    except:
        pass
    return sorted(list(set(ip_list)))

class SpeedTestHandler(BaseHTTPRequestHandler):
    def log_message(self, format, *args): return

    def do_HEAD(self):
        self.send_response(200)
        self.send_header("Content-type", "application/octet-stream")
        self.send_header("Content-Length", str(ONE_GB))
        self.end_headers()

    def do_GET(self):
        # DOWNLOAD TEST
        self.send_response(200)
        self.send_header("Content-type", "application/octet-stream")
        self.send_header("Content-Length", str(ONE_GB))
        self.send_header("Cache-Control", "no-store")
        self.end_headers()

        chunk = b"\0" * (256 * 1024)
        try: self.connection.setsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF, 4 * 1024 * 1024)
        except: pass

        try:
            while True: self.wfile.write(chunk)
        except (BrokenPipeError, ConnectionResetError, ConnectionAbortedError): pass

    def do_POST(self):
        # UPLOAD TEST
        self.send_response(200)
        self.end_headers()
        try: self.connection.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, 4 * 1024 * 1024)
        except: pass

        try:
            while True:
                if not self.rfile.read(256 * 1024): break
        except (BrokenPipeError, ConnectionResetError, ConnectionAbortedError): pass

if __name__ == '__main__':
    httpd = ThreadingHTTPServer(("0.0.0.0", 8000), SpeedTestHandler)
    httpd.allow_reuse_address = True
    
    all_ips = get_all_lan_ips()
    
    print(f"✅ Speed Test Server running on port 8000")
    print("--------------------------------------------------")
    print("Enter one of these addresses in the app (use your PC's Wi-Fi/Ethernet IP):")
    
    if all_ips:
        for ip in all_ips:
            print(f"   👉 http://{ip}:8000")
    else:
        # Fallback if detection fails
        print("   👉 http://:8000")

    print("--------------------------------------------------")
    
    try: httpd.serve_forever()
    except KeyboardInterrupt: pass
    httpd.server_close()

How to Run

1
Connect via Wire

Connect this PC directly to your router using an Ethernet Cable. If your PC is on Wi-Fi, you will be measuring two wireless links, resulting in slower, inaccurate data.

2
Run the Script

Ensure Python 3 is installed. Open your terminal in the folder where you saved the file and run:

python3 server.py
3
Enter IP Address

In the app, enter the IP address displayed by the script into the "PC IP Address" box and tap Run Throughput Test.

http://192.168.1.15:8000
⚠️ Troubleshooting
Firewall: If the connection times out, your computer's Firewall is likely blocking Port 8000. Please allow Python through your firewall or temporarily disable it for the test.