def recv(self, socket_, encoding=None):
unpacker = msgpack.Unpacker(encoding=encoding)<EOL>response = socket_.recv(<NUM_LIT:8>)  <EOL>if response == b"<STR_LIT>":<EOL><INDENT>raise TensorForceError("<STR_LIT>" +<EOL>"<STR_LIT>")<EOL><DEDENT>orig_len = int(response)<EOL>received_len = <NUM_LIT:0><EOL>while True:<EOL><INDENT>data = socket_.recv(min(orig_len - received_len, self.max_msg_len))<EOL>if not data:<EOL><INDENT>raise TensorForceError("<STR_LIT>".<EOL>format(orig_len - received_len))<EOL><DEDENT>data_len = len(data)<EOL>received_len += data_len<EOL>unpacker.feed(data)<EOL>if received_len == orig_len:<EOL><INDENT>break<EOL><DEDENT><DEDENT>for message in unpacker:<EOL><INDENT>sts = message.get("<STR_LIT:status>", message.get(b"<STR_LIT:status>"))<EOL>if sts:<EOL><INDENT>if sts == "<STR_LIT>" or sts == b"<STR_LIT>":<EOL><INDENT>return message<EOL><DEDENT>else:<EOL><INDENT>raise TensorForceError("<STR_LIT>".<EOL>format(message.get("<STR_LIT:message>", "<STR_LIT>")))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise TensorForceError("<STR_LIT>")<EOL><DEDENT><DEDENT>raise TensorForceError("<STR_LIT>".<EOL>format(orig_len))<EOL>
Receives a message as msgpack-numpy encoded byte-string from the given socket object.
Blocks until something was received.

Args:
    socket_: The python socket object to use.
    encoding (str): The encoding to use for unpacking messages from the socket.
Returns: The decoded (as dict) message received.