iotcommon.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:IotCenter 作者: panjanek 项目源码 文件源码
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]))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号