def handle(self):
try:
data = self.request[0]
clientAddr = self.client_address;
self.logger.debug("UDP packet from {0}:{1}, length {2}".format(clientAddr[0], clientAddr[1], len(data)))
self.logger.debug("message hex : %s", binascii.hexlify(data))
if data[0:4] == "IOT\xff":
self.logger.debug("heartbeat packet - ignoring")
elif data[0:4] == "IOT\0" and len(data)>=88 and ((len(data)-72)%16) == 0:
self.handleIotPacket(data, clientAddr)
else:
self.logger.warning("unknown packet - ignoring")
except Exception as e:
self.logger.exception(e)
except:
self.logger.error("error on handling incomming packet: {0} ".format(sys.exc_info()[0]))
评论列表
文章目录