def sendMessage(self, typeStr, mes): #发送信息 send_mes = {'Mtype': typeStr, 'Mes': mes} send_json = json.dumps(send_mes, sort_keys=True, indent=4) code_json = crypto.encrypt(send_json) if self.sock != None: self.sock.send(code_json)
def sendMessage(typeStr, mes): send_mes = {'Mtype': typeStr, 'Mes': mes, 'lockState': lockState} # send_json = json.dumps(send_mes, sort_keys=True, indent=4) send_json = json.dumps(send_mes) code_json = crypto.encrypt(send_json) if client != None: client.send(code_json)
def sendMessage(sock, typeStr, mes=None, lockLink=None, lockState=None): #发送信息 send_mes = {'Mtype': typeStr} if mes != None: send_mes['Mes'] = mes if lockLink != None: send_mes['lockLink'] = lockLink if lockState != None: send_mes['lockState'] = lockState send_json = json.dumps(send_mes) # send_json = json.dumps(send_mes, sort_keys=True, indent=4) code_json = crypto.encrypt(send_json) if sock != None: sock.send(code_json)