def __listen_forever(port, callback):
        """ Listens to a given port, and calls callback in case a message
        arrives. This method never returns, except when the connection closed or
        could not be established. """
        sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
        sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
        try:
            sock.bind(("127.0.0.1", port))
            while True:
                data, addr = sock.recvfrom(1024)  # pylint: disable=unused-variable
                callback(data.decode("utf-8"))
        finally:
            sock.close()
 Listens to a given port, and calls callback in case a message
        arrives. This method never returns, except when the connection closed or
        could not be established. 
metadrive/render_pipeline/rpcore/util/network_communication.py