def METHOD_NAME(self):
    # Does Read and Write , as python is not socket thread-safe
    while self.running:
        if self._connection is None:
            # Connection not yet ready !
            self.logging_tcpip("Error", "tcpip_read_from_zigate Connection not yet ready !")
            if tcp_re_connect(self):
                continue
            return "SocketClosed"
        socket_list = [self._connection]
        if self._connection.fileno() == -1:
            self.logging_tcpip("Error", "tcpip_read_from_zigate Socket seems to be closed!!!! ")
            if tcp_re_connect(self):
                continue
            return "SocketClosed"
        readable, writable, exceptional = select.select(socket_list, socket_list, [], 5)
        # Read data if any
        data = None
        if readable:
            if self.pluginconf.pluginConf["ZiGateReactTime"]:
                # Start
                self.reading_thread_timing = 1000 * time.time()
            try:
                data = self._connection.recv(1024)
                self.logging_tcpip("Debug", "Receiving: %s" %str(data))
                if data:
                    decode_and_split_message(self, data)
            except Exception as e:
                self.logging_tcpip(
                    "Error",
                    "tcpip_read_from_zigate: Connection error while receiving data %s on %s" % (e, self._connection),
                )
                if tcp_re_connect(self):
                    continue
                return "WifiError"
        # Write data if any
        if self.tcp_send_queue.qsize() > 0 and writable:
            encode_data = self.tcp_send_queue.get()
            self.logging_tcpip("Debug", "Sending: %s" %str(encode_data))
            try:
                len_data_sent = self._connection.send(encode_data)
                if len_data_sent != len(encode_data):
                    self.logging_tcpip(
                        "Error", "tcpip_read_from_zigate - Not all data have been sent !!! Please report !!!!%s "
                    )
                continue
            except Exception as e:
                self.logging_tcpip(
                    "Error",
                    "tcpip_read_from_zigate: Connection error while sending data %s on %s" % (e, self._connection),
                )
                if tcp_re_connect(self):
                    continue
                return "WifiError"
        elif exceptional:
            self.logging_tcpip("Error", "native_write_to_zigate We have detected an error .... on %s" % self._connection)
            if tcp_re_connect(self):
                continue
            return "WifiError"
        time.sleep(0.05)
    self.logging_tcpip("Status", "ZigateTransport: ZiGateTcpIpListen Thread stop.")
    stop_waiting_on_queues(self)