[Twisted-Python] Twisted.Names assistance with auth and additional sections
Sean Leach
kickdaddy at gmail.com
Tue Mar 20 21:16:59 MDT 2007
Sweet! That was it. Explicitly creating the Resolver worked like a
charm (don't ask me why :) ). Thanks!
On 3/20/07, Jean-Paul Calderone <exarkun at divmod.com> wrote:
> On Tue, 20 Mar 2007 16:13:14 -0700, Sean Leach <kickdaddy at gmail.com> wrote:
> >Thanks Jean-Paul,
> >
> >I tried changing to queryUDP, and it just sits there, never sends out
> >a query (watching with tcpdump). If I change it to _lookup, which it
> >looks like queryUDP calls, it sends the query, but like lookupAddress,
> >I don't get the additional and auth sections still...
> >
> >What is weird, when I do this
> >
> >deferred = resolver.queryUDP([Dns.Query(name, dns.IN, dns.A)])
> >
> >and I try and debug why it's hanging, I put a print in the
> >ResolverBase.queryUDP function right at the top, and it never prints.
> >
>
> The factoring here is a little weird. Try creating a t.names.client.Resolver
> explicitly (just instantiate it with a servers list or a resolv.conf filename)
> and calling queryUDP on it (unless you were doing this already). The
> createResolver function does some other stuff which might be getting in the
> way here, either of functioning or debugging.
>
> Here's an example (using t/conch/stdio.py):
>
> >>> from twisted.names import dns, client
> >>> r = client.Resolver(servers=[('198.41.0.4', 53)])
> >>> d = r.queryUDP([dns.Query('google.com', dns.IN, dns.A)])
> >>> d
> <Deferred at 0xB78F072CL current result: <twisted.names.dns.Message instance at 0xb79b6aec>>
> >>> d.result
> <twisted.names.dns.Message instance at 0xb79b6aec>
> >>> d.result.authority
> [<snip - a bunch of records>]
> >>> d.result.additional
> [<snip - a bunch of records>]
> >>> d.result.answers
> []
> >>>
>
> Hope this helps things,
>
> Jean-Paul
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
More information about the Twisted-Python
mailing list