En Fri, 30 Jan 2009 10:16:42 -0200, Giampaolo Rodola' <gne...@gmail.com> escribió:
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)...

>>>> 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

...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

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to