Thanks you. I&#39;ve resolved it! ;)<br>&nbsp;<br><br><div><span class="gmail_quote">On 8/8/07, <b class="gmail_sendername">Christopher Armstrong</b> &lt;<a href="mailto:radix@twistedmatrix.com">radix@twistedmatrix.com</a>&gt; 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 &lt;<a href="mailto:nayuhz@gmail.com">nayuhz@gmail.com</a>&gt; wrote:<br>&gt; Hi all, I run a reactor in my thread, so I will get many connection by<br>&gt; twisted, and I run another thread for write back data to any connection.
<br><br>You don&#39;t need to have multiple threads to communicate with multiple<br>connections!<br><br>&gt; But I&#39;ve found the data is in buffer, not sent back<br>&gt; immediately.<br><br>This is because you&#39;re calling Twisted functions from non-reactor
<br>threads. Twisted doesn&#39;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&#39;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