[Twisted-Python] XMPP server connection question

Christopher Zorn christopher.zorn at gmail.com
Tue Dec 2 08:59:37 EST 2008


On Tue, Dec 2, 2008 at 8:21 AM, Gabriel Rossetti <
gabriel.rossetti at arimaz.com> wrote:

> Gabriel Rossetti wrote:
>
>> Hello everyone,
>>
>> I wrote an XMPP client and I have a question, when it tries to connect and
>> the server is not listening, it doesn't send back an error and tries
>> forever. I see that this function (twisted/names/srvconnect.py):
>>
>> def _ebGotServers(self, failure):
>>       failure.trap(DNSNameError)
>>
>>       # Some DNS servers reply with NXDOMAIN when in fact there are
>>       # just no SRV records for that domain. Act as if we just got an
>>       # empty response and use fallback.
>>
>>       self.servers = []
>>       self.orderedServers = []
>>
>> traps the exception so it never propagates to me, so I can't handle it.
>> Any ideas? I using the XMPP client example as a base for my code.
>>
>> Thank you,
>> Gabriel
>>
> Ok, the code I showed has nothing to do with the problem I think, what I
> don't get is the client never returns an error if nobody's listening...
>

It may be better to show a log of what is happening.

It should show something like the following :

2008-12-02 08:57:01-0500 [-] reactor class:
twisted.internet.selectreactor.SelectReactor.
2008-12-02 08:57:01-0500 [-] Starting factory
<twisted.words.protocols.jabber.xmlstream.XmlStreamFactory object at
0xf6b490>
2008-12-02 08:57:02-0500 [-] /etc/resolv.conf changed, reparsing
2008-12-02 08:57:02-0500 [-] Resolver added ('192.168.2.1', 53) to server
list
2008-12-02 08:57:02-0500 [-] <class 'twisted.names.dns.DNSDatagramProtocol'>
starting on 31847
2008-12-02 08:57:02-0500 [-] Starting protocol
<twisted.names.dns.DNSDatagramProtocol object at 0xfb9a90>
2008-12-02 08:57:02-0500 [-] (Port 31847 Closed)
2008-12-02 08:57:02-0500 [-] Stopping protocol
<twisted.names.dns.DNSDatagramProtocol object at 0xfb9a90>
2008-12-02 08:57:02-0500 [-] <twisted.names.srvconnect.SRVConnector instance
at 0xa236c8> will retry in 2 seconds
2008-12-02 08:57:02-0500 [-] Stopping factory
<twisted.words.protocols.jabber.xmlstream.XmlStreamFactory object at
0xf6b490>

This will keep trying until you quit. You can set a limit on how many times
it retries.



>
> Best regards,
>
> Gabriel
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20081202/db253d0d/attachment.htm 


More information about the Twisted-Python mailing list