Hey,<div><br></div><div>I am trying to design a twisted application, (I&#39;m pretty new to twisted and networking in general) and I feel like I&#39;m not approaching it quite the right way and would appreciate your feedback. First part, is that I am trying to couple twisted with an existing graphics-type application, that already has it&#39;s own main loop, etc. Meaning, I need to be running other python code while I have the reactor running. Is the solution threading?</div>

<div><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="1038.35">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco}
</style>


<p class="p1">  </p><p class="p1">  f = MyFactory()</p></div><div><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="1038.35">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco}
span.s1 {color: #00bf00}
span.s2 {text-decoration: underline ; color: #00bf00}
span.s3 {color: #a30000}
</style>


<p class="p1">  reactor.connectTCP(<span class="s1">&quot;</span><span class="s2">localhost</span><span class="s1">&quot;</span>,<span class="s3">22223</span>,f)</p>
<p class="p1">  t = threading.Thread(target=reactor.run)</p>
<p class="p1">  t.run()</p><p class="p1">  runOtherCodeConcurrently()</p><p class="p1"><br></p>Is there a better solution? Second question is that, in that other bunch of code, I need to be able to write things to the socket. How can I access the instance of my protocol subclass that is used by the factory, so I can make protocolInstance.transport.write type calls? Or am I thinking about this is a completely wrong way?</div>

<div><br></div><div>Thank you very much for your help!</div><div><br></div><div>Kurt</div>