2
# Twisted, the Framework of Your Internet
3
# Copyright (C) 2001 Matthew W. Lefkowitz
5
# This library is free software; you can redistribute it and/or
6
# modify it under the terms of version 2.1 of the GNU Lesser General Public
7
# License as published by the Free Software Foundation.
9
# This library is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
# Lesser General Public License for more details.
14
# You should have received a copy of the GNU Lesser General Public
15
# License along with this library; if not, write to the Free Software
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
from twisted.names import dns
19
from twisted.internet import main
21
def printMessage( message ):
22
print "ID:", message.id
23
print "IsAnswer:", message.answer
24
print "rCode:", message.rCode
26
for q in message.queries:
28
for list, title in ( ( message.answers, "Answers:" ),
29
( message.ns, "NS:" ),
30
( message.add, "Additional records:" ) ):
34
for i in range( len( rr.data ) ):
35
print ord( rr.data[ i ] ),
42
self.boss = dns.DNSBoss()
44
def handleAnswer( self, message ):
45
printMessage( message )
49
self.boss.stopReadingBoth()
54
x.boss.queryUDP( ( "129.199.129.1", 53 ),
58
x.boss.queryTCP( ( "129.199.129.1", 53 ),