def verify_server_startup(host: str, port: int, timeout: float = 5.0) -> bool:
    """Verifies if a server is up and running by attempting to connect."""
    start_time = time.time()
    while time.time() - start_time < timeout:
        try:
            with socket.create_connection((host, port), timeout=1):
                return True
        except (TimeoutError, OSError):
            time.sleep(0.1)
    return False
Verifies if a server is up and running by attempting to connect.
gradio/node_server.py