def encode_message(self): message = b'' message += self.header.encode_header() question = DNSQuestion(self.q_type, self.host_name) message += question.encode_question() return message
def encode_message(self, is_TCP): message = b'' message += self.header.encode_header() question = DNSQuestion(self.q_type, self.host_name) message += question.encode_question() if is_TCP: message = struct.pack('!H', len(message)) + message return message