8.4.11. pymodaq_utils.mysocket module

Created the 26/10/2023

@author: Sebastien Weber

class pymodaq_utils.mysocket.Socket(socket=None)[source]

Bases: object

Custom Socket wrapping the built-in one and added functionalities to make sure message have been sent and received entirely

Attributes:
socket

Methods

check_received_length(length)

Make sure all bytes (length) that should be received are received through the socket

check_sended(data_bytes)

Make sure all bytes are sent through the socket :param data_bytes: :type data_bytes: bytes

get_first_nbytes(length)

Read the first N bytes from the socket

accept

bind

close

connect

getsockname

listen

recv

send

sendall

accept()[source]
bind(*args, **kwargs)[source]
check_received_length(length)[source]

Make sure all bytes (length) that should be received are received through the socket

Parameters:

length (int) – The number of bytes to be read from the socket

Return type:

bytes

check_sended(data_bytes)[source]

Make sure all bytes are sent through the socket :param data_bytes: :type data_bytes: bytes

close()[source]
connect(*args, **kwargs)[source]
get_first_nbytes(length)[source]

Read the first N bytes from the socket

Parameters:

length (int) – The number of bytes to be read from the socket

Returns:

bytes

Return type:

bytes

getsockname(*args, **kwargs)[source]
listen(*args, **kwargs)[source]
recv(*args, **kwargs)[source]
send(*args, **kwargs)[source]
sendall(*args, **kwargs)[source]
property socket