472,352 Members | 1,521 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,352 software developers and data experts.

twisted: not doing DNS resolutions?

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.
Jul 19 '05 #1
2 1846
Christopher Subich wrote:
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)


Update: after doing some diving in the twisted source, it is supposed to
do that. My guess is that either it thinks the hostname is a valid ip
address (unlikely), or a callback isn't actually getting called. This
confuses me.
Jul 19 '05 #2
Christopher Subich wrote:
Christopher Subich wrote:
From what I can tell, the problem lies in that Twisted simply isn't
performing the DNS resolutions. From the connection factory's


.... right, finally figured it out after a very long time at debugging
the beast.

It's an interaction with IDLE.

What happens is that the deferToThread call in twisted's lookup Just
Doesn't Run Right (under some circumstances) when it's run under IDLE
with tksupport. I finally got the idea to run the application from the
command line, and it worked just fine. This is kind of odd, since a
trivial test case run from the interactive idle prompt works okay, but
it's now 5am and I'm going to sleep.

Moral: beware the IDLEs of March.
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Paul Moore | last post by:
I hit a problem yesterday with my mail connection. In a desparate attempt to understand what was going on, I wanted to log the connection traffic....
3
by: xam | last post by:
Hi All, I have got a bit of a complicated situation here: I need to get buildBot (and hence twisted) running on RH 7.1, which currently has python...
2
by: Mark Carter | last post by:
I'm trying to create a mail server in Twisted. I either get SMTPSenderRefused or SMTPException: SMTP AUTH extension not supported by server. ...
11
by: mir nazim | last post by:
hi, i m planning to start writing intranet applications and want ur real cool advices for choosing the correct platform. the choice is between the...
2
by: Qp | last post by:
Is this even possible? I'm designing a simple chat and game client/server as an intro to Python, and it would be nice to represent the different...
3
by: Rico Huijbers | last post by:
Does anybody have experience in writing Jabber clients with Twisted? I came across a simple sample, and tried to build out from it, but for some...
2
by: Taki Jeden | last post by:
Hi Anybody used wxPython with twisted? I started putting together a Twisted-based app with wx GUI, and the widgets just don't work - some...
2
by: SeSe | last post by:
Hi, I am new to Twisted. I use a Twisted 1.3.0 on MS Windows XP Home Edition, my python version is 2.3 I try the TCP echoserv.py and...
0
by: Matthew Warren | last post by:
Looking through those docs quickly leads me into quite a bewildering maze. As a kind of way to perhaps get me heading in the right direction and...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.