Hey,

I am trying to design a twisted application, (I'm pretty new to twisted and
networking in general) and I feel like I'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's own main loop, etc. Meaning, I need to be running other
python code while I have the reactor running. Is the solution threading?



  f = MyFactory()

  reactor.connectTCP("localhost",22223,f)

  t = threading.Thread(target=reactor.run)

  t.run()

  runOtherCodeConcurrently()


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?

Thank you very much for your help!

Kurt
_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to