def receive()

in aepsych/server.py [0:0]


    def receive(self):
        # catch the Error and reset the connection
        while True:
            try:
                if self.conn is None:
                    logger.info("Waiting for connection...")
                    self.conn, self.addr = self.socket.accept()
                recv_result = b""
                while recv_result == b"":
                    logger.info(f"Connected by {self.addr}, waiting for messages...")
                    recv_result = self.conn.recv(1024 * 512)  # 512KiB
                    logger.debug(f"receive : result = {recv_result}")
                    msg = json.loads(recv_result)

                logger.info(f"Got: {msg}")
                break
            except Exception as e:
                self.conn.close()
                self.conn, self.addr = None, None
                logger.info(
                    "Exception caught while trying to receive a message from the client. "
                    f"Ignoring message and trying again. The caught exception was: {e}."
                )
        return msg