def METHOD_NAME(self):
    with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: 
        s.bind((socket.gethostname(), self.port))
        s.listen(1)
        print(f"Agent listening on {socket.gethostname()}:{self.port} using token {self.token}")
        while True:
            connection, _ = s.accept()
            with connection:
                request = receive_data(connection)
                data = self.handle_request(request) # type: ignore
                response = Response(data, self.token, request.request_id)
                send_data(response, connection, timeout=2)