twisted: not doing DNS resolutions?

Christopher Subich spam.csubich+block at block.subich.spam.com
Thu Jun 30 09:36:13 CEST 2005


I'm building an application that makes several user-specified internet 
connections; twisted meets my needs more or less perfectly.

I'm running into a problem, however, in that twisted is not allowing 
connections (reactor.connectTCP) by hostname, only IP address. [read: 
connections to IP addresses work fine, hostnames no]

 From what I can tell, the problem lies in that Twisted simply isn't 
performing the DNS resolutions.  From the connection factory's 
startedConnecting method, print connector.getDestination() results in:

IPv4Address(TCP, 'hostname', port)

That is to say, the port is correct, but the 'hostname' is completely 
unresolved.  Since 'hostname' is a really bad IP address, not being one 
at all, the connection of course fails.  A check via tcpdump on my 
gateway machine shows that the DNS resolution doesn't occur.

The API documentation for version 1.3 (I'm using 2.0.1, but a quick 
check of twisted source/docstrings shows this to be still true[1]) shows 
that connectTCP taks "a host name," so by that (and the echo client 
example that connects to 'localhost') I presume there's supposed to be 
some sort of resolution going on.

I'm running twisted 2.0.1 on win32.  Is this a bug in twisted, or is 
there some configuration that I've gone and borked?

[1] -- is there some reason in particular that there's no API reference 
for twisted 2.0x? The documentation/tutorials are pretty sparse as-is, I 
think.



More information about the Python-list mailing list