[Twisted-Python] Plain windows sockets and twisted

Daniel Griffin dgriff1 at gmail.com
Sun Jan 17 21:55:22 EST 2010


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
"[Failure instance: Traceback (failure with no frames): <class 't
wisted.internet.error.ConnectionLost' Connection to the other side was lost
in
 a non-clean fashion.". I am using IP4 TCP sockets.

I realize python threads are defective but in this case they are easier to
deal with.

I will create a chunk of sample code and send it to the list.

Thanks,
Dan



On Sun, Jan 17, 2010 at 6:52 PM, Glyph Lefkowitz <glyph at twistedmatrix.com>wrote:

>
> On Jan 17, 2010, at 6:25 PM, Daniel Griffin wrote:
>
> > 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.
> >
> > 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.
>
> You should use Twisted for your server and get rid of threads, or you
> should very carefully read <http://itamarst.org/writings/win32sockets.html>
> and understand the differences between what windows calls "sockets" and what
> the rest of the world does.
>
> > 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.
>  .
>  .
>  .
> >
> > 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.
>
> You'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.  (<http://sscce.org/> is a good resource explaining desirable
> attributes of such an example.)
>
> 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?
>
> 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's just what's *supposed* to happen: there's a bug
> here, and with the information I have now, I can't say whether it's in your
> threaded code, your Twisted code, Twisted, or even Python.
>
> Good luck?
>
>
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20100117/60ebcafa/attachment.htm 


More information about the Twisted-Python mailing list