473,387 Members | 1,650 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 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 1888
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. After a bit of searching, I found a post on c.l.p...
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 1.5 installed. From browsing newsgroups it...
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. What do I need to do to get it to work?
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 three: 1. Twisted 2. Medusa 3. Zope (i do...
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 interfaces (public chat room, private chat rooms,...
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 reason it's barely working. When I run the...
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 controls do not show up etc. - at least on my system....
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 echoclient.py example. But the client always fail with...
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 understanding how I start to hang all that...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.