Hi,

On Thu, August 20, 2009 00:12, Kevin Chen wrote:
> On Wed, 19 Aug 2009, Enrico Tröger wrote:
>
>> So, I changed the code above to use dns.query.tcp() and then I actually
I get the expected result. But I'd prefer to use UDP by default and
also fallback to TCP if necessary.
>> The question is now: is there a better way to check whether I need to
query via TCP than by checking whether q.answer is empty? I'd have
expected that dnspython raises an exception and this is why in the
except handler I have the TCP variant. But so far, no exception is
thrown instead the q.anser object is just empty.
>
> I use (answer.flags & dns.flags.TC) to check whether the truncate (TC)
bit is checked, which indicates that the response was truncated.

Thanks, this was exactly what I was looking for and it works fine.


>> Just to be clear, some other DNS servers with less information output
on ANY I tested work with the above code. And I also get
>> the expected results for dnspython.org if I query specific RR types
like MX or similar, the problem is only with the type ANY.
>
> Querying for -t any for dnspython.org results in a packet larger than
512 bytes (in this case, because dnspython.org has as lot of
DNSSEC-related records), so the answers do not fit in a standard DNS UDP
packet, and retrying on TCP is necessary to get the full answer.

This is what I guessed, thanks for clarification.


Regards,
Enrico


_______________________________________________
dnspython-users mailing list
[email protected]
http://howl.play-bow.org/mailman/listinfo.cgi/dnspython-users

Reply via email to