

def _recv_tag_raw(sock):
    'Read a tag and the associated data from a socket\n\n    Parameters\n    ----------\n    sock : socket.socket\n        The socket from which to read the tag.\n\n    Returns\n    -------\n    tag : instance of Tag\n        The tag.\n    buff : str\n        The raw data of the tag (including header).\n    '
    s = sock.recv((4 * 4))
    if (len(s) != 16):
        raise RuntimeError('Not enough bytes received, something is wrong. Make sure the mne_rt_server is running.')
    tag = Tag(*np.fromstring(s, '>i4'))
    n_received = 0
    rec_buff = [s]
    while (n_received < tag.size):
        n_buffer = min(4096, (s.size - n_received))
        this_buffer = sock.recv(n_buffer)
        rec_buff.append(this_buffer)
        n_received += len(this_buffer)
    if (n_received != tag.size):
        raise RuntimeError('Not enough bytes received, something is wrong. Make sure the mne_rt_server is running.')
    buff = ''.join(rec_buff)
    return (tag, buff)

dataset/ETHPy150Open mne-tools/mne-python/mne/realtime/client.py _recv_tag_raw/VarMisuse@87/252 `tag`->`s`