Thank you for the response. I am using twisted 9.0 and tried 8.2. The python version is 2.6. When I print the reason sent to connection lost I get &quot;[Failure instance: Traceback (failure with no frames): &lt;class &#39;t<div>
wisted.internet.error.ConnectionLost&#39; Connection to the other side was lost in</div><div> a non-clean fashion.&quot;. I am using IP4 TCP sockets. </div><div><br></div><div>I realize python threads are defective but in this case they are easier to deal with.</div>
<div><br></div><div>I will create a chunk of sample code and send it to the list. </div><div><br></div><div>Thanks,</div><div>Dan</div><div><br></div><div><br></div><br><div class="gmail_quote">On Sun, Jan 17, 2010 at 6:52 PM, Glyph Lefkowitz <span dir="ltr">&lt;<a href="mailto:glyph@twistedmatrix.com">glyph@twistedmatrix.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im"><br>
On Jan 17, 2010, at 6:25 PM, Daniel Griffin wrote:<br>
<br>
&gt; I am using twisted in a cross-platform manner. I have written both the client and server. The client is twisted and the server uses python threads. I am using the select reactor and plain old TCP connections. I encode my messages to JSON to send them.<br>

&gt;<br>
&gt; On Windows I get tons of un-clean connectionlost events, on Mac everything works perfectly. I am using the same data set in each case.<br>
<br>
</div>You should use Twisted for your server and get rid of threads, or you should very carefully read &lt;<a href="http://itamarst.org/writings/win32sockets.html" target="_blank">http://itamarst.org/writings/win32sockets.html</a>&gt; and understand the differences between what windows calls &quot;sockets&quot; and what the rest of the world does.<br>

<div class="im"><br>
&gt; If I use the threaded server on windows and the twisted client on mac then I still get tons of errors. 99% of these times these errors happen after the last dataReceived when the socket should be closed cleanly.<br>

</div> .<br>
 .<br>
<div class="im"> .<br>
&gt;<br>
&gt; Is this the correct behavior for using plain sockets with twisted? Any reason why this would be perfectly fine on OSX and not Windows? Sorry for the long email.<br>
<br>
</div>You&#39;ll need to give some more detail.  What errors are you seeing?  Please post a complete traceback, along with enough code to actually trigger the error.  (&lt;<a href="http://sscce.org/" target="_blank">http://sscce.org/</a>&gt; is a good resource explaining desirable attributes of such an example.)<br>

<br>
What version of Twisted are you using?  What version of Python?  What is the protocol?  Are the errors occurring in your threaded server or your twisted client?<br>
<br>
The quick answer to your question is: no, this behavior is not expected.  Sockets are sockets.  Twisted should work fine talking to sockets in threads, sockets in other programming languages, other operating systems, etc.  Of course, that&#39;s just what&#39;s *supposed* to happen: there&#39;s a bug here, and with the information I have now, I can&#39;t say whether it&#39;s in your threaded code, your Twisted code, Twisted, or even Python.<br>

<br>
Good luck?<br>
<br>
<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" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br>
</blockquote></div><br>