En Fri, 12 Dec 2008 15:22:34 -0200, Emanuele D'Arrigo <man...@gmail.com>
escribió:
Thank you both for the suggestions! Eventually I tried with threading
as illustrated in the code below.
And it works pretty well! The only problem I'm having with it is that
as the server is a daemon the program should end when the client
thread cease to be alive. But it doesn't seem to work that way and I'm
not sure what's going on! I did achieve my objective though. Two
separate instances of the code below will happily send random numbers
to each other for a few seconds!
If you're using 2.5 or older, override serve_forever:
def serve_forever(self):
while not getattr(self, 'quit', False):
self.handle_request()
and set the server 'quit' attribute to True in response to some command
from the client.
Python 2.6 has a shutdown() method for the same purpose.
--
Gabriel Genellina
--
http://mail.python.org/mailman/listinfo/python-list