[Tutor] SocketObject.close() question

Michael P. Reilly arcege@speakeasy.net
Sun, 17 Feb 2002 09:59:42 -0500


On Thu, Feb 14, 2002 at 11:49:32AM +0100, Andreas Sch=F6ller wrote:
> port =3D 9000
> server =3D SocketServer.TCPServer(('', port), RequestHandler)
> server.allow_reuse_address =3D 1
> server.serve_forever()
>=20
> which also, did not work, because the attribute-setting comes too late.=
=20
> I ended up with changing the default in the module, with one question=20
> remaining :  How can one use this setting without subclassing ?

Looking at the code, the value is used when the instance is created.
So you would have to change TCPServer and _then_ create the instance.

SocketServer.TCPServer.allow_reuse_address =3D 1
server =3D SocketServer.TCPServer(('', port), RequestHandler)
server.server_forever()

  -Arcege