[Tutor] More network server questions

Tino Dai tinoloc at gmail.com
Tue Jun 20 16:47:43 CEST 2006


> so, I think you've to set the allow_reuse_address for the TCPServer and
> not for the RequestHandler, because this class is newly instantiated for
> each request of your server.
> The socket itself is bound by the TCPServer.
>
> HTH Ewald


Hi there Ewald,

     I tried that, and still no joy. Now I have:

class Listener( threading.Thread ):
        sema = threading.Semaphore()
        def __init__(self):
                self.port=xxxx
                self.ipAddr='xxx.xxx.xxx.xxx'
                self.wholeFilenameList=[]
                threading.Thread.__init__(self)
                #print "Done with init"


        def run(self):
                server=SocketServer.TCPServer(('',self.port), FtpServer)
                server.allow_reuse_address = 1    <- I moved the
server.allow_reuse_adddress from the FtpServer, which was
SocketServer.StreamRequestHandler
                print "The port is: ", self.port
                server.serve_forever()


Any clue on what I am missing?

-Tino
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20060620/4b0903ce/attachment.htm 


More information about the Tutor mailing list