def unpack(self,reader): data = Data() (ip, port, serverid) = struct.unpack(self.format_str, reader.read(struct.calcsize(self.format_str))) ip = socket.inet_ntoa(ip) data.ip = ip data.port = port data.serverid = "%s" % serverid data.type = packet_types.ANNOUNCE return data
def unpack(self, reader): data = Data() (ip, port, serverid) = struct.unpack( self.format_str, reader.read(struct.calcsize(self.format_str))) ip = socket.inet_ntoa(ip) data.ip = ip data.port = port data.serverid = "%s" % serverid data.type = packet_types.ANNOUNCE return data
def unpack(self,reader): """Extracts data from an heartbeat packet""" (ip, port, serverid) = struct.unpack(self.format_str, reader.read(struct.calcsize(self.format_str))) ip = socket.inet_ntoa(ip) data = Data() data.ip = ip data.port = port data.serverid = "%s" % serverid data.type = packet_types.CHK_DONE return data
def unpack(self, reader): """Extracts data from an heartbeat packet""" (ip, port, serverid) = struct.unpack( self.format_str, reader.read(struct.calcsize(self.format_str))) ip = socket.inet_ntoa(ip) data = Data() data.ip = ip data.port = port data.serverid = "%s" % serverid data.type = packet_types.CHK_DONE return data