pymasep.communication.base_threaded_communication ================================================= .. py:module:: pymasep.communication.base_threaded_communication Classes ------- .. autoapisummary:: pymasep.communication.base_threaded_communication.BaseThreadedCommunication Module Contents --------------- .. py:class:: BaseThreadedCommunication(ident, socket_handler_class, socket_handler_args, host, port, log_level) Base class for threaded communication for Client and Server :param ident: string id of the client or server. :param host: Host to listen or connect. :param port: Port to listen or connect. :param socket_handler_class: Class used to handle the socket (send, receive). :param socket_handler_args: Arguments as tuple to instantiate the SocketHandler class. :param log_level: Log level messages to log as str or int. Default is logging.WARNING. .. py:attribute:: id id of the communication thread .. py:attribute:: host host to listen or connect .. py:attribute:: port port to listen or connect .. py:attribute:: socket socket used to listen or connect .. py:attribute:: logger :type: logging.Logger communication logger .. py:attribute:: socket_handler_class class to handle message from/to socket .. py:attribute:: socket_handler_args socket handler arguments .. py:attribute:: _current_connections keep trace of current connections .. py:attribute:: _current_connections_lock lock to handle multiple connections at the same time .. py:method:: add_connection(ident, sh) Add a connection to the client or server :param ident: ID of the opposite BaseThreadCommunication connected to self. :param sh: Instance of the socket handler used to handle this connection .. py:method:: get_connection(ident) Get the socket handler of the connection :param ident: ID of the connection :return: the socket handler .. py:method:: is_connection_registered(ident) Check if a connection is registered in this BaseThreadCommunication. :param ident: ID of the connection :return: True if a socket handler is associated to this connection id .. py:method:: send_frame_to(ident, frame) Send a frame to a connection identified by ident :param ident: ID of the connection to send a frame. :param frame: Frame to send.