2006年03月08日 星期三 16:33
版本是2.2.0 dns.Query的构造函数定义: def __init__(self, name='', type=A, cls=IN): """ @type name: C{str} @param name: The name about which to request information. @type type: C{int} @param type: The query type. @type cls: C{int} @param cls: The query class. """ self.name = Name(name) self.type = type self.cls = cls root.Resolver 里的一个调用 def discoveredAuthority(self, auth, name, cls, type, timeout): from twisted.names import client q = dns.Query(name, cls, type) r = client.Resolver(servers=[(auth, dns.PORT)]) d = r.queryUDP([q], timeout) d.addCallback(r.filterAnswers) return d cache.CacheResolver里的一个调用 def _lookup(self, name, cls, type, timeout): now = time.time() q = dns.Query(name, cls, type) try: when, (ans, auth, add) = self.cache[q] except KeyError: if self.verbose > 1: log.msg('Cache miss for ' + repr(name)) return defer.fail(failure.Failure(dns.DomainError(name))) else: ............ 两个调用参数cls, type的位置写反了 我也不懂DNS协议,程序里mx记录一直查询为空,最后用的commview跟踪nslookup命名和我的程序的UDP数据,发现最后4个字节的位置反了,才发现这个问题的 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060308/4e819743/attachment.html
Zeuux © 2025
京ICP备05028076号