[Twisted-Python] twisted.names.client.getHostByName() vs. reactor.resolve()

Benjamin Rutt rutt.4 at osu.edu
Sun Jul 13 08:16:05 MDT 2014


Hi,

I need to do a DNS resolution of a hostname to an IPv4 address in order to
then send out a UDP packet via twisted’s APIs.  There appears to be 2 ways
to do this.  Is it better to use twisted.names.client.getHostByName(), or
is it better to use reactor.resolve()?  Is there a bias for one over the
other?  Is one deprecated and the other isn’t?

BTW they appear to behave differently; at work, I have a hostname that the
one (getHostByName) resolves to None in the callback, and the other
(reactor.resolve) resolves to a valid IP address in the callback.  That
analysis is based on twisted 12.3.0 on linux.  Naturally I'm preferring
reactor.resolve at this point, as it works better for the hostname in
question (it happens to be a hostname that uses a CNAME record to alias to
another hostname).

Thanks,


-- 
Benjamin Rutt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://twistedmatrix.com/pipermail/twisted-python/attachments/20140713/c0485e88/attachment.html>


More information about the Twisted-Python mailing list