> 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(...)
> I acknowledge that I am trying to hack it rather then looking at all the
> web 1st:
> sorry if I am spamming this list while good documentation exists. But
> does it?
Sure:
http://docs.python.org/library/socketserver.html#SocketServer.allow_reuse_address
The server classes support the following class variables:
SocketServer.allow_reuse_address
Whether the server will allow the reuse of an address. This defaults to
False, and can be set in subclasses to change the policy.
Reading the source may help too :)
--
Gabriel Genellina
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
...but potentially unsafe if the application uses other servers in other
places. C'mon, defining the new class can be a one-liner also, why take
the risk?
--
Gabriel Genellina
...but potentially unsafe if the application uses other servers in other
Sorry the duplicate post! I've seen that some of my messages come twice.
I'll try to diagnose and fix the problem (if possible...).
--
Gabriel Genellina