How to stop an [Rpyc] server thread?

Felipe Almeida Lessa felipe.lessa at gmail.com
Tue Sep 12 02:28:46 CEST 2006


7 Sep 2006 23:38:08 -0700, Tal Einat <tal.no.no.spam at gmail.com>:
> > I'm not an expert in socket programming, but I can't see the
> > correlation between the "listener socket" being in timeout mode and a
> > different behavior the other sockets..
> > Anyhow the main goal is being able to shut down the thread of the rpyc
> > server, any other way is an appreciated suggestion.
>
> Now to the real issue. I've also had such weird problems with socket
> timeout in Python. The best workaround I found is to use select() to
> check for activity on the socket(s), and use select()'s timeout
> mechanism. So far, this has worked without a hitch on both WindowsXP
> and Solaris Sparc9 installations.

Twisted[1] is the answer. I've never seen a better framework for using
sockets, it's painless.  I created two versions of the same protocol
(both client and server), one using sockets + select, another using
Twisted. The sockets version had 2x lines than the Twisted one and
lots of bugs. Sockets may fail *anywhere* in your code, and Twisted
takes care of all details for you[2]. Simply Sweet.

Cheers,

[1] http://www.twistedmatrix.com/
[2] Of couse this is just *one* advantage of the Twisted framework...

PS.: No, I wasn't paid for this e-mail ;-)

-- 
Felipe.



More information about the Python-list mailing list