On 30 Gen, 10:16, "Gabriel Genellina" <gagsl-...@yahoo.com.ar> wrote:
> En Fri, 30 Jan 2009 05:43:33 -0200, Mabooka-Mabooka Mbe-Mbe  
> <ochichinyezaboom...@yahoo.com> escribió:
>
> >   setsockopt(REUSEADDR)...
>
> > What I came up with so far is this:
> >>>> from SocketServer import *
> >>>> s = TCPServer( ('', 32123), None)
> >>>> dir(s)
> > ['RequestHandlerClass', '__doc__', '__init__', '__module__',  
> > 'address_family', 'allow_reuse_address', ... ]
>
> > Aha! My bet is (was):
> >>>> s.allow_reuse_address=1
> > should do the trick.
>
> It's too late then; bind() has already been called. The easiest way is to  
> define your own derived class:
>
> import SocketServer
>
> class TCPServer(SocketServer.TCPServer):
>      allow_reuse_address = True
>
> s = TCPServer(...)

What's even faster is setting the class attribute right after the
module import:

>>> import SocketServer
>>> SocketServer.TCPServer.allow_reuse_address = True


--- Giampaolo
http://code.google.com/p/pyftpdlib
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to