8.4.2.2. pymodaq_utils.serialize.mysocket module
- class pymodaq_utils.serialize.mysocket.Socket(socket=None)[source]
Bases:
SocketCustom Socket wrapping the built-in one and added functionalities to make sure message have been sent and received entirely
Methods
check_receiving(bytes_str)First read the 4th first bytes to get the total message length Make sure to read that much bytes before processing the message
check_sended(data_bytes)Make sure all bytes are sent through the socket :param data_bytes: :type data_bytes:
bytesConvenience function to convert permitted objects to bytes and then use the check_sended method
- check_receiving(bytes_str)[source]
First read the 4th first bytes to get the total message length Make sure to read that much bytes before processing the message
See check_sended and check_sended_with_serializer for a symmetric action
- class pymodaq_utils.serialize.mysocket.SocketString(bytes_string)[source]
Bases:
objectMimic the Socket object but actually using a bytes string not a socket connection
Implements a minimal interface of two methods
- Parameters:
bytes_string (
bytes)
See also
SocketMethods
check_received_length(length)Make sure all bytes (length) that should be received are received through the socket.
get_first_nbytes(length)Read the first N bytes from the socket
to_bytes
- check_received_length(length)[source]
Make sure all bytes (length) that should be received are received through the socket.
Here just read the content of the underlying bytes string