Ticket #3998: dns_test_2.py

File dns_test_2.py, 396 bytes (added by pythonologist, 5 years ago)

simple dns test program

Line 
1
2
3from twisted.internet import defer, reactor
4from twisted.python.failure import Failure
5import twisted.names.client
6
7def do_lookup(do_lookup):
8    d = twisted.names.client.getHostByName(domain)
9    d.addBoth(lookup_done)
10
11def lookup_done(result):
12    print 'result:', result
13    reactor.stop()
14
15domain = 'www.bbc.co.uk'   
16reactor.callLater(0, do_lookup, domain)
17reactor.run()