Thanks you. I've resolved it! ;)<br> <br><br><div><span class="gmail_quote">On 8/8/07, <b class="gmail_sendername">Christopher Armstrong</b> <<a href="mailto:radix@twistedmatrix.com">radix@twistedmatrix.com</a>> wrote:
</span><blockquote class="gmail_quote" style="margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; margin-left: 0.80ex; border-left-color: #cccccc; border-left-width: 1px; border-left-style: solid; padding-left: 1ex">
On 8/7/07, Yan Zhu <<a href="mailto:nayuhz@gmail.com">nayuhz@gmail.com</a>> wrote:<br>> Hi all, I run a reactor in my thread, so I will get many connection by<br>> twisted, and I run another thread for write back data to any connection.
<br><br>You don't need to have multiple threads to communicate with multiple<br>connections!<br><br>> But I've found the data is in buffer, not sent back<br>> immediately.<br><br>This is because you're calling Twisted functions from non-reactor
<br>threads. Twisted doesn't support this. The *only* threadsafe function<br>to call is reactor.callFromThread. You pass it a function to run in<br>the reactor thread.<br><br>If all you need is concurrent asynchronous I/O, you don't need
<br>threads. Twisted is an *asynchronous* networking framework. You can do<br>all of your communication efficiently in one thread.<br><br>--<br>Christopher Armstrong<br>International Man of Twistery<br><a href="http://radix.twistedmatrix.com/">
http://radix.twistedmatrix.com/</a><br><a href="http://twistedmatrix.com/">http://twistedmatrix.com/</a><br><a href="http://canonical.com/">http://canonical.com/</a><br><br>_______________________________________________<br>
Twisted-Python mailing list<br><a href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a><br><a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
</a><br></blockquote></div><br><br clear="all"><br>-- <br>eSX