tcpsockets/client.py
def receive(self, chunk_size: int = None, byte_converter: Callable[[bytes], Any] = None) -> Any:
        """
        Receive a python object sent by the server. First receive a fixed length header then receive the pickled object
        chunk by chunk using the chunk_size argument.
        Args:
            chunk_size(int): The amount of bytes to receive at once. Defaults to tcpsockets.settings.default_chunk_size.
            byte_converter(Callable[[bytes], Any]): Function to convert bytes to object.
        Returns:
            Any: The object sent by the server
        """
        if chunk_size is None:
            chunk_size = default_chunk_size
        obj_size_header: str = self.socket.recv(default_header_size).decode("utf-8")
        obj_size: int = int(obj_size_header.strip())
        bytes_obj = b""
        for _ in range(obj_size // chunk_size):
            bytes_obj += self.socket.recv(chunk_size)
        bytes_obj += self.socket.recv(obj_size % chunk_size)
        return pickle.loads(bytes_obj) if byte_converter is None else byte_converter(bytes_obj)

        Receive a python object sent by the server. First receive a fixed length header then receive the pickled object
        chunk by chunk using the chunk_size argument.
        Args:
            chunk_size(int): The amount of bytes to receive at once. Defaults to tcpsockets.settings.default_chunk_size.
            byte_converter(Callable[[bytes], Any]): Function to convert bytes to object.
        Returns:
            Any: The object sent by the server
        
Receive a python object sent by the server. First receive a fixed length header then receive the pickled object
chunk by chunk using the chunk_size argument.
Receive a python object sent by the server . First receive a fixed length header then receive the pickled object chunk by chunk using the chunk_size argument .
def receive(self, chunk_size: int = None, byte_converter: Callable[[bytes], Any] = None) -> Any:
        if chunk_size is None:
            chunk_size = default_chunk_size
        obj_size_header: str = self.socket.recv(default_header_size).decode("utf-8")
        obj_size: int = int(obj_size_header.strip())
        bytes_obj = b""
        for _ in range(obj_size // chunk_size):
            bytes_obj += self.socket.recv(chunk_size)
        bytes_obj += self.socket.recv(obj_size % chunk_size)
        return pickle.loads(bytes_obj) if byte_converter is None else byte_converter(bytes_obj)
def receive ( self , chunk_size : int = None , byte_converter : Callable [ [ bytes ] , Any ] = None ) -> Any : if chunk_size is None : chunk_size = default_chunk_size obj_size_header : str = self . socket . recv ( default_header_size ) . decode ( "utf-8" ) obj_size : int = int ( obj_size_header . strip ( ) ) bytes_obj = b"" for _ in range ( obj_size // chunk_size ) : bytes_obj += self . socket . recv ( chunk_size ) bytes_obj += self . socket . recv ( obj_size % chunk_size ) return pickle . loads ( bytes_obj ) if byte_converter is None else byte_converter ( bytes_obj )
Receive a python object sent by the server.
Receive a python object sent by the server .
"""
        Receive a python object sent by the server. First receive a fixed length header then receive the pickled object
        chunk by chunk using the chunk_size argument.
        Args:
            chunk_size(int): The amount of bytes to receive at once. Defaults to tcpsockets.settings.default_chunk_size.
            byte_converter(Callable[[bytes], Any]): Function to convert bytes to object.
        Returns:
            Any: The object sent by the server
        """
The object sent by the server
The object sent by the server
Any
self
chunk_size
int
The amount of bytes to receive at once. Defaults to tcpsockets.settings.default_chunk_size.
The amount of bytes to receive at once . Defaults to tcpsockets . settings . default_chunk_size .
tcpsockets.settings.default_chunk_size
byte_converter
Callable[[bytes], Any]
Function to convert bytes to object.
Function to convert bytes to object .