tcpsockets/server.py
def send_to(self, obj: Any, client: "Client", byte_converter: Callable[[Any], bytes] = None):
        """
        Send a python object that can be pickled to the client. First sends a fixed length header defined in
        tcpsockets.settings giving the size of outgoing message then sends the pickled object. default_header_size
        can be set by using tcpsockets.settings.set_default_header_size function.

        Args:
            client(Client): Which client to send it to
            obj(Any): The Object that has to be sent to the client that can be pickled.
            byte_converter(Callable[[Any], bytes]): Function to convert object to bytes.

        Returns:
            None
        """
        if byte_converter is None:
            bytes_obj = pickle.dumps(obj)
        else:
            bytes_obj = byte_converter(obj)
        bytes_obj_size = len(bytes_obj)
        header = str(bytes_obj_size).ljust(default_header_size).encode("utf-8")
        self.socket.sendto(header, address=(client.ip, client.port))
        self.socket.sendto(bytes_obj, address=(client.ip, client.port))

        Send a python object that can be pickled to the client. First sends a fixed length header defined in
        tcpsockets.settings giving the size of outgoing message then sends the pickled object. default_header_size
        can be set by using tcpsockets.settings.set_default_header_size function.

        Args:
            client(Client): Which client to send it to
            obj(Any): The Object that has to be sent to the client that can be pickled.
            byte_converter(Callable[[Any], bytes]): Function to convert object to bytes.

        Returns:
            None
        
Send a python object that can be pickled to the client. First sends a fixed length header defined in
tcpsockets.settings giving the size of outgoing message then sends the pickled object. default_header_size
can be set by using tcpsockets.settings.set_default_header_size function.
Send a python object that can be pickled to the client . First sends a fixed length header defined in tcpsockets . settings giving the size of outgoing message then sends the pickled object . default_header_size can be set by using tcpsockets . settings . set_default_header_size function .
def send_to(self, obj: Any, client: "Client", byte_converter: Callable[[Any], bytes] = None):
        if byte_converter is None:
            bytes_obj = pickle.dumps(obj)
        else:
            bytes_obj = byte_converter(obj)
        bytes_obj_size = len(bytes_obj)
        header = str(bytes_obj_size).ljust(default_header_size).encode("utf-8")
        self.socket.sendto(header, address=(client.ip, client.port))
        self.socket.sendto(bytes_obj, address=(client.ip, client.port))
def send_to ( self , obj : Any , client : "Client" , byte_converter : Callable [ [ Any ] , bytes ] = None ) : if byte_converter is None : bytes_obj = pickle . dumps ( obj ) else : bytes_obj = byte_converter ( obj ) bytes_obj_size = len ( bytes_obj ) header = str ( bytes_obj_size ) . ljust ( default_header_size ) . encode ( "utf-8" ) self . socket . sendto ( header , address = ( client . ip , client . port ) ) self . socket . sendto ( bytes_obj , address = ( client . ip , client . port ) )
Send a python object that can be pickled to the client.
Send a python object that can be pickled to the client .
"""
        Send a python object that can be pickled to the client. First sends a fixed length header defined in
        tcpsockets.settings giving the size of outgoing message then sends the pickled object. default_header_size
        can be set by using tcpsockets.settings.set_default_header_size function.

        Args:
            client(Client): Which client to send it to
            obj(Any): The Object that has to be sent to the client that can be pickled.
            byte_converter(Callable[[Any], bytes]): Function to convert object to bytes.

        Returns:
            None
        """
None
self
obj
Any
The Object that has to be sent to the client that can be pickled.
The Object that has to be sent to the client that can be pickled .
client
"Client"
Which client to send it to
Which client to send it to
byte_converter
Callable[[Any], bytes]
Function to convert object to bytes.
Function to convert object to bytes .