Hello, after looking into the docs of ServerSocket, the class TCPServer notes the following class attributes:
Class variables that may be overridden by derived classes or instances: - address_family - socket_type - request_queue_size (only for stream sockets) - allow_reuse_address 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 Tino Dai wrote: > Hi Everybody, > > I took Kent's advice, and used SocketServer instead of rolling my > own sockets. It works pretty good except for the fact that when I exit > and restart the program, I get a Address in use. And I remember that > Danny told me about allow_reuse_address. So, that's where I got stuck. I > put in that statement, but no change. What am I missing? > > class FtpServer ( SocketServer.StreamRequestHandler): > def handle(self): > self.allow_reuse_address = 1 > self.filename=self.rfile.readline(512) > self.filename=string.strip (self.filename) > while (self.filename != 'exit'): > secQueue.put(self.filename) > Listener.sema.release() > self.filename=self.rfile.readline (512) > self.filename=string.strip(self.filename) > > class Listener( threading.Thread ): > sema = threading.Semaphore() > def __init__(self): > self.port=4242 > self.ipAddr='140.147.241.58' > self.wholeFilenameList=[] > threading.Thread.__init__(self) > #print "Done with init" > > def run(self): > server=SocketServer.TCPServer(('',self.port), FtpServer) > print "The port is: ", self.port > > > Thanks, > Tino > > > ------------------------------------------------------------------------ > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor -- Ing. Ewald Ertl HartterGruppe Phone : +43-3352-33085-558 trinomic Projektmanagement & Informationstechnik GmbH Fax : +43-3352-33085-600 Wiener Straße 41 mailto:[EMAIL PROTECTED] A-7400 Oberwart http://www.trinomic.com mailto:[EMAIL PROTECTED] _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor