def doWork(): for ip in file("list12.txt"): i = a.next() ip = ip.strip() d = Deferred() name = Name('version.bind') axf = AXFRController(name,d) dns = DNSDatagramProtocol(axf) query = Query() query.name = Name('version.bind') query.type = TXT query.cls = CH query = [query] d1 = dns.query((ip,53), query) d1.addCallback(getResult,ip) d1.addErrback(getError,ip) yield d1