On Tue, Nov 10, 2009 at 7:25 AM, morbidux <[email protected]> wrote:

> Hi all,
>
> I'm writing a simple client / server application, that uses a small
> protocol to dialog.
>
> I can't find in documentation any exemple that would correspond to what my
> client is supposed to do.
>
> Here is the basics :
>
>  every X seconds, call a function that check a file
>  if file is different, connect to server
>
> When the client is connected, it immediatly sends data to server, using
> the connectionMade method.
>
> Do I need to use while(1) loop or loopingCall ? What is the best way to
> write a daemon that connect to a server every X seconds ?
>
> Many thanks.
>
>
>
A while loop will probably block your application.  Use loopingCall (or even
callLater, if you want).

Here's an example:
http://www.saltycrane.com/blog/2008/10/running-functions-periodically-using-twisteds-loopingcall/

Kevin Horn
_______________________________________________
Twisted-Python mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to