[Twisted-Python] Re: Using FQDN with transport.write calls...

Jean-Paul Calderone exarkun at divmod.com
Sun Aug 13 16:22:27 MDT 2006


On Sun, 13 Aug 2006 17:38:17 -0400, "Chaz." <eprparadocs at gmail.com> wrote:
>Tim Allen wrote:
>>On 14 Aug 2006, at 06:38, Chaz. wrote:
>>>>>Jean-Paul Calderone wrote:
>>>>>>On Sun, 13 Aug 2006 07:28:51 -0400, "Chaz." <eprparadocs at gmail.com> 
>>>>>>wrote:
>>>>>>>My application requires that I use FQDN in place of the normal IP 
>>>>>>>addresses in transport.write calls.
>>>>>>
>>>>>>No it doesn't.  What behavior would you expect this to provide which 
>>>>>>you
>>>>>>desire in your application?
>>>
>>>Sorry for the top-post. What I want to do is the following
>>>
>>>     self.transport.write(data,('www.foobar.com',6000))
>>>
>>>I think that says it succinctly.
>>
>>I think that Jean-Paul was trying to say something like this: 
>>"self.transport is a file-like object, so its write() method takes only 
>>data. It wouldn't make sense to supply an IP address and port to 
>>sys.stdout.write(), why do you expect that self.transport.write() would 
>>accept one?"
>
>Because it does for datagrams, and that is how I am using it. What I am 
>asking, is instead of supplying an (IP address, port) I would like to use 
>(fqdn,port). There are sometimes I want to use the DNS system to resolve the 
>address.

So, you want to resolve a name to an address?  Sorry, it was very unclear
from your initial question that that was your goal.  This is easily done,
and you have already correctly identifier the API to use, reactor.resolve().

Jean-Paul




More information about the Twisted-Python mailing list