INNER CODE UNIT · Python
ReceivePayload
unrealcv/unrealcv · client/python/unrealcv/__init__.py:80
def ReceivePayload(cls, sock):
"""
Return only payload, not the raw message, None if failed.
sock: a blocking socket for read data.
"""
try:
raw_magic = cls._recv_exact(sock, 4)
except Exception as e:
_L.debug('Fail to read raw_magic, exception: "%s"', e)
raw_magic = None
if not raw_magic:
# _L.debug('socket disconnect by server')
return None
magic = struct.unpack(cls.fmt, raw_magic)[0] # 'I' means unsigned int
if magic != cls.magic:
print(