[Twisted-Python] Q about handling CTRL-C correctly

Stefan Näwe naewe.s at atlas.de
Mon May 9 04:17:54 MDT 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Tommi Virtanen schrieb:
>> class SimpleServer(Protocol):
>>     def connectionMade(self):
>>         m = self.factory.msg()
>>         while running:
>>             self.transport.write(m.pack())
>>             sys.stderr.write(".")
>>             time.sleep(1)
>>         self.transport.loseConnection()
> 
> That's blocking code, right there. Don't use time.sleep with twisted.

OK.

> See task.LoopingCall and reactor.callLater.

task.LoopingCall did the job.

THX

Stefan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (Cygwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCfzjSsDu9QQ7KHU4RAuLyAJ4/aJ2DJczHGOiFN9tEfwQJ8+nQnQCfWqyC
MduFQL3dI4EMVR68MC9hPJM=
=obJJ
-----END PGP SIGNATURE-----





More information about the Twisted-Python mailing list