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.<br>
<br><br><div class="gmail_quote">On Tue, Nov 11, 2008 at 6:28 PM, <span dir="ltr"><<a href="mailto:glyph@divmod.com">glyph@divmod.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">On 08:41 pm, <a href="mailto:nebpro@gmail.com" target="_blank">nebpro@gmail.com</a> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Thank you very much for the response. I am still new with twisted so please<br>
bare with me.<br>
</blockquote>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
What I mean by checking connection is something like instant messenger (i.e.<br>
pidgin) do in some interval time. Pidgin is checking for internet connection<br>
every xx minutes to see if the computer still connected to the internet. So<br>
I am wondering if twisted can do the same thing. Once it is connected (i.e.<br>
connectionMade), can we tell if that connection still alive or not every xx<br>
minutes? Is twisted maintain persistent connection?<br>
</blockquote>
<br></div>
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).<br>
<br>
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.<div>
<div></div><div class="Wj3C7c"><br>
<br>
_______________________________________________<br>
Twisted-Python mailing list<br>
<a href="mailto:Twisted-Python@twistedmatrix.com" target="_blank">Twisted-Python@twistedmatrix.com</a><br>
<a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br>
</div></div></blockquote></div><br>