示例#1
0
文件: Packets.py 项目: buchwj/xvector
    def SerializeBody(self):
        # create a buffer
        data = cStringIO.StringIO()

        # calculate the login screen flags
        flags = 0
        if self.RegistrationDisabled: flags |= self.Flag_NoRegister
        BinaryStructs.SerializeUint8(data, flags)

        # store the other fields
        try:
            BinaryStructs.SerializeUTF8(data, self.ServerName)
            BinaryStructs.SerializeUTF8(data, self.ServerNewsURL)
        except:
            raise IncompletePacket

        # return the packet
        retval = data.getvalue()
        data.close()
        return retval
示例#2
0
文件: Packets.py 项目: buchwj/xvector
 def SerializeBody(self):
     # All we have to do is write the rejection code...
     data = cStringIO.StringIO()
     BinaryStructs.SerializeUint8(data, self.RejectionCode)