Exemple #1
0
 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
Exemple #2
0
 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
Exemple #3
0
 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
Exemple #4
0
    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