def _send_command(self, command):
        """Send a command to the server

        Parameters
        ----------
        command : str
            The command to send.

        Returns
        -------
        resp : str
            The response from the server.
        """

        logger.debug('Sending command: %s' % command)
        command += '\n'
        self._cmd_sock.sendall(command.encode('utf-8'))

        buf, chunk, begin = [], '', time.time()
        while True:
            # if we got some data, then break after wait sec
            if buf and time.time() - begin > self._timeout:
                break
            # if we got no data at all, wait a little longer
            elif time.time() - begin > self._timeout * 2:
                break
            try:
                chunk = self._cmd_sock.recv(8192)
                if chunk:
                    buf.append(chunk)
                    begin = time.time()
                else:
                    time.sleep(0.1)
            except:
                pass

        return ''.join(buf)
dataset/ETHPy150Open mne-tools/mne-python/mne/realtime/client.py/RtClient._send_command/original