<div class="gmail_quote">On Tue, Nov 10, 2009 at 7:25 AM, morbidux <span dir="ltr">&lt;<a href="mailto:morbidux@free.fr">morbidux@free.fr</a>&gt;</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;">
Hi all,<br>
<br>
I&#39;m writing a simple client / server application, that uses a small<br>
protocol to dialog.<br>
<br>
I can&#39;t find in documentation any exemple that would correspond to what my<br>
client is supposed to do.<br>
<br>
Here is the basics :<br>
<br>
 every X seconds, call a function that check a file<br>
  if file is different, connect to server<br>
<br>
When the client is connected, it immediatly sends data to server, using<br>
the connectionMade method.<br>
<br>
Do I need to use while(1) loop or loopingCall ? What is the best way to<br>
write a daemon that connect to a server every X seconds ?<br>
<br>
Many thanks.<br>
<br>
<br></blockquote></div><br>A while loop will probably block your application.  Use loopingCall (or even callLater, if you want).<br><br>Here&#39;s an example: <a href="http://www.saltycrane.com/blog/2008/10/running-functions-periodically-using-twisteds-loopingcall/">http://www.saltycrane.com/blog/2008/10/running-functions-periodically-using-twisteds-loopingcall/</a><br>
<br>Kevin Horn<br>