[Twisted-Python] checking connection

Benny nebpro at gmail.com
Tue Nov 11 22:03:27 EST 2008

Thank you very much for your explanation. I did pay attention to the
behavior, and I did noticed that when there is no traffic connection, the
connectionLost will be called and it will also called the
clientConnectionLost too. I used ReconnectingClientFactory in the
clientConnectionLost to ensure that the connection is established, and used
the reactor.stop() when i have to stop my application. I really appreciate
everyone helps. Thank you very much.

On Tue, Nov 11, 2008 at 6:28 PM, <glyph at divmod.com> wrote:

> On 08:41 pm, nebpro at gmail.com wrote:
>> Thank you very much for the response. I am still new with twisted so
>> please
>> bare with me.
>  What I mean by checking connection is something like instant messenger
>> (i.e.
>> pidgin) do in some interval time. Pidgin is checking for internet
>> connection
>> every xx minutes to see if the computer still connected to the internet.
>> So
>> I am wondering if twisted can do the same thing. Once it is connected
>> (i.e.
>> connectionMade), can we tell if that connection still alive or not every
>> xx
>> minutes? Is twisted maintain persistent connection?
> You're confusing two mostly unrelated things.  Pidgin tracks the state of
> your network interfaces by way of dbus notifications from NetworkManager,
> not by "checking every XX minutes".  You could do this with Twisted by using
> the glib2 reactor and the dbus bindings, but that's more of a
> dbus/NetworkManager question than a twisted question. I would strongly
> recommend that you don't bother with this kind of connection-tracking.  My
> personal experience of applications trying to use this information (Pidgin
> included) is mostly that they are buggy and have a broken idea of the
> machine's network interface state because it's very hard to understand how
> this information can be effectively used (and NetworkManager itself is not
> perfect, sometimes reporting incorrect results).
> Pidgin (and every other networking application in the world) also tracks
> the state of individual network connections (i.e. your connection to an IRC
> server, or to AOL's AIM server) by waiting for notifications from their
> respective sockets.  In Twisted, this is the stuff related to connectionLost
> that JP Calderone already mentioned in his reply to you. This is what you
> should be relying on in your Twisted application.  Even if you implement
> "internet connection" checking with NetworkManager or some other platform's
> equivalent, that's just a hint; you still have to pay attention to
> connectionLost.
> _______________________________________________
> 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/20081111/8a728c00/attachment.htm 

More information about the Twisted-Python mailing list