INNER CODE UNIT · Python
SocketMessage
unrealcv/unrealcv · client/python/unrealcv/__init__.py:54
class SocketMessage:
"""
Define the format of a message. This class is defined similar to the class FNFSMessageHeader in UnrealEngine4, but without CRC check.
The magic number is from Unreal implementation
See https://github.com/EpicGames/UnrealEngine/blob/dff3c48be101bb9f84633a733ef79c91c38d9542/Engine/Source/Runtime/Sockets/Public/NetworkMessage.h
"""
magic = ctypes.c_uint32(0x9E2B83C1).value
fmt = 'I'
def __init__(self, payload):
self.payload_size = ctypes.c_uint32(len(payload)).value
@classmethod
def _recv_exact(cls, sock, nbytes):
chunks = []
remaining = nbytes
while remaining: