def recv_array(<EOL>socket,<EOL>flags=<NUM_LIT:0>,<EOL>copy=False,<EOL>track=False,<EOL>poll=None,<EOL>poll_timeout=<NUM_LIT><EOL>):
if poll is None:<EOL><INDENT>md = socket.recv_json(flags=flags)<EOL><DEDENT>else:<EOL><INDENT>socks = dict(poll.poll(poll_timeout))<EOL>if socks.get(socket) == zmq.POLLIN:<EOL><INDENT>reply = socket.recv_json(flags=flags)<EOL>md = reply<EOL><DEDENT>else:<EOL><INDENT>raise NoResponseException(<EOL>"<STR_LIT>")<EOL><DEDENT><DEDENT>if md['<STR_LIT>'] == <NUM_LIT:0>:<EOL><INDENT>A = None<EOL><DEDENT>elif md['<STR_LIT>'] == <NUM_LIT:1>:<EOL><INDENT>if poll is None:<EOL><INDENT>msg = socket.recv(flags=flags, copy=copy, track=track)<EOL><DEDENT>else:<EOL><INDENT>socks = dict(poll.poll(poll_timeout))<EOL>if socks.get(socket) == zmq.POLLIN:<EOL><INDENT>reply = socket.recv(flags=flags, copy=copy, track=track)<EOL>msg = reply<EOL><DEDENT>else:<EOL><INDENT>raise NoResponseException(<EOL>"<STR_LIT>")<EOL><DEDENT><DEDENT>buf = buffer(msg)<EOL>A = np.frombuffer(buf, dtype=md['<STR_LIT>'])<EOL>A = A.reshape(md['<STR_LIT>'])<EOL>if '<STR_LIT>' in md:<EOL><INDENT>A = np.ma.masked_equal(A, md['<STR_LIT>'])<EOL><DEDENT><DEDENT>else:<EOL><INDENT>A = np.zeros(np.prod(md['<STR_LIT>']), dtype=md['<STR_LIT>'])<EOL>arr_position = <NUM_LIT:0><EOL>for i in range(md['<STR_LIT>']):<EOL><INDENT>if poll is None:<EOL><INDENT>msg = socket.recv(flags=flags, copy=copy, track=track)<EOL><DEDENT>else:<EOL><INDENT>socks = dict(poll.poll(poll_timeout))<EOL>if socks.get(socket) == zmq.POLLIN:<EOL><INDENT>reply = socket.recv(flags=flags, copy=copy, track=track)<EOL>if not reply:<EOL><INDENT>raise EmptyResponseException(<EOL>"<STR_LIT>")<EOL><DEDENT>msg = reply<EOL><DEDENT>else:<EOL><INDENT>raise NoResponseException(<EOL>"<STR_LIT>")<EOL><DEDENT><DEDENT>buf = buffer(msg)<EOL>a = np.frombuffer(buf, dtype=md['<STR_LIT>'])<EOL>A[arr_position:arr_position + a.shape[<NUM_LIT:0>]] = a[:]<EOL>arr_position += a.shape[<NUM_LIT:0>]<EOL><DEDENT>A = A.reshape(md['<STR_LIT>'])<EOL>if '<STR_LIT>' in md:<EOL><INDENT>A = np.ma.masked_equal(A, md['<STR_LIT>'])<EOL><DEDENT><DEDENT>return A, md<EOL>
recv a metadata and an optional numpy array from a zmq socket

    Optionally provide poll object to use recv_array with timeout

    poll_timeout is in millis