def handle(self):
    try:
        while True:
            try:
                data = self.request.recv(1024)
            except socket.timeout:
                print((((self.ip + ':') + str(self.port)) + '接收超时'))
                break
            if data:
                data = data_decode(data)
                self.device.parse_data(data, self)
            else:
                break
    except Exception as e:
        with open('err_log.log', 'a+') as f:
            f.write((traceback.format_exc() + '\r\r'))
        print(self.client_address, '连接断开')
    finally:
        self.request.close()
def handle(self):
    try:
        while True:
            try:
                data = self.request.recv(1024)
            except socket.timeout:
                print((((self.ip + ':') + str(self.port)) + '接收超时'))
                break
            if data:
                data = data_decode(data)
                self.device.parse_data(data, self)
            else:
                break
    except Exception as e:
        with open('err_log.log', 'a+') as f:
            f.write((traceback.format_exc() + '\r\r'))
        print(self.client_address, '连接断开')
    finally:
        self.request.close()