<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
On 09/19/2011 02:44 PM, Fabian Rothfuchs wrote:
<blockquote cite="mid:CA9D0564.1B406%25fabian.rothfuchs@gmail.com"
type="cite">
<div style="color: rgb(0, 0, 0); font-family: Calibri,sans-serif;
font-size: 14px;">Hi Guys,</div>
[...]
<div style="color: rgb(0, 0, 0); font-family: Calibri,sans-serif;
font-size: 14px;">So I wonder, if you can dynamically feed the
reactor with new tasks (I use connectTCP for it), as it's not
possible to start/stop it on demand (or if there's an
alternative approach):</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,sans-serif;
font-size: 14px;"><br>
</div>
</blockquote>
Hi,<br>
in general you do [whatever you want] in response to some event,
which might be connectionMade, dataReceived, a periodic call from
LoopingCall, a one-shot event from reactor.callLater or any other
API that informs you about certain events. You can take your code,
as in your example, and run it inside one of these callables or
another callable you trigger from there. You absolutely do not have
to set up everything before you call reactor.run. Just create a
callable (at any time), make sure that whatever should trigger it
gets a reference to it, and then call it whenever appropriate. Also,
look at Deferreds, they provide an API for callbacks, chaining them
together and other useful stuff.<br>
<br>
regards,<br>
Johann<br>
<br>
</body>
</html>