SOAPpy port reuse

Maurice LING mauriceling at
Sun Nov 18 15:17:42 CET 2007

Diez B. Roggisch wrote:
> Maurice LING schrieb:
>> Hi,
>> I have a problem:
>> 1. Assuming that my application is a SOAP server that uses SOAPpy,
>> 2. I am given port 35021 for use.
>> What I normally do (simply) is:
>> functionlist = [<some exposed functions>]
>> import SOAPpy
>> server = SOAPpy.SOAPServer((<some host>, 35021))
>> for func in functionlist: server.registerFunction(func)
>> server.serve_forever()
>> My question is: How can I shutdown this server and reuse port 35021 
>> when my functionlist changes?
>> Currently, after killing the python process which runs this SOAP 
>> server, the port (35021 in this case) cannot be re-used, as though it 
>> is still phantom-ly bounded to some process (which should have been 
>> killed).
> It shouldn't be that way. Either you still have some process lying 
> around hogging the port. Or the OS needs a while to re-enable the port 
> for allocation. That happened to me quite a few times.
> Shutting down gracefully might speed up things I guess.

I am under the impression that SOAPpy.SOAPServer.serve_forever() is an 
"endless" loop. I had been suggested to see if there is a method of 
SOAPpy.SOAPServer (which I can call through a wrapper function in 
functionlist) that can enable me to gracefully shutdown the server.

Any advice?


More information about the Python-list mailing list