SOAPpy port reuse

Piet van Oostrum piet at
Sun Nov 18 15:44:45 CET 2007

>>>>> Maurice LING <mauriceling at> (ML) wrote:

>ML> Hi,
>ML> I have a problem:

>ML> 1. Assuming that my application is a SOAP server that uses SOAPpy,
>ML> 2. I am given port 35021 for use.

>ML> What I normally do (simply) is:

>ML> functionlist = [<some exposed functions>]
>ML> import SOAPpy
>ML> server = SOAPpy.SOAPServer((<some host>, 35021))
>ML> for func in functionlist: server.registerFunction(func)
>ML> server.serve_forever()

>ML> My question is: How can I shutdown this server and reuse port 35021 when my
>ML> functionlist changes?

>ML> Currently, after killing the python process which runs this SOAP server,
>ML> the port (35021 in this case) cannot be re-used, as though it is still
>ML> phantom-ly bounded to some process (which should have been killed).

This phenomenon is explained here:
or the Unix socket FAQ ( 2.7

Normally the solution is to set the SO_REUSEADDR option in the socket (the
original one) before binding it:

However, SOAPPy does that already so it should work.
Piet van Oostrum <piet at>
URL: [PGP 8DAE142BE17999C4]
Private email: piet at

More information about the Python-list mailing list