def get_process_on_port(port: int) -> psutil.Process | None:
    """Get the process on the given port.

    Args:
        port: The port.

    Returns:
        The process on the given port.
    """
    for proc in psutil.process_iter(["pid", "name", "cmdline"]):
        with contextlib.suppress(
            psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess
        ):
            if importlib.metadata.version("psutil") >= "6.0.0":
                conns = proc.net_connections(kind="inet")
            else:
                conns = proc.connections(kind="inet")
            for conn in conns:
                if conn.laddr.port == int(port):
                    return proc
    return None
Get the process on the given port.

    Args:
        port: The port.

    Returns:
        The process on the given port.
    
reflex/utils/processes.py