INNER CODE UNIT · Python
_recv_exact
unrealcv/unrealcv · client/python/unrealcv/__init__.py:68
def _recv_exact(cls, sock, nbytes):
chunks = []
remaining = nbytes
while remaining:
chunk = sock.recv(remaining)
if not chunk:
return None
chunks.append(chunk)
remaining -= len(chunk)
return b''.join(chunks)
@classmethod
def ReceivePayload(cls, sock):
"""
Return only payload, not the raw message, None if failed.
sock: a blocking socket for read data.
"""
try: