import http.server import socketserver import socket PORT = 8080 class ReusableTCPServer(socketserver.TCPServer): allow_reuse_address = True Handler = http.server.SimpleHTTPRequestHandler # Explicitly bind to IPv4 address 0.0.0.0 so all LAN devices can connect try: with ReusableTCPServer(("0.0.0.0", PORT), Handler) as httpd: print(f"==================================================") print(f" 羚牛氢能驾驶舱 - 局域网 (IPv4) 服务已建立") print(f" 本机访问: http://localhost:{PORT}") print(f" 局域网访问: http://192.168.110.62:{PORT}") print(f"==================================================") httpd.serve_forever() except Exception as e: print(f"Server error: {e}")