xmlrpc tutorial?

Carsten Gaebler clpy at snakefarm.org
Mon Dec 3 08:39:51 EST 2001


Stephen Coursen wrote:

> Ah ha, the problem is due to how you're using TCPServer.  Try:
> 
> SocketServer.TCPServer.reuse_address = 1
> server = SocketServer.TCPServer( ('', 8000), TestRequestHandler )
> server.serve_forever( )

Skip Montanaro wrote:

> In my server I override the server_bind method like so:
> 
>     def server_bind(self):
>         self.socket.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1)
>         self.socket.bind(self.server_address)

Thanks for your suggestions, but none of these work. Could it be I'm
doing something terribly wrong? At least I could reduce the problem:

If I start the server and immediately shut it down via Ctrl-C, the
address can be reused. If I shut it down after it has served at least
one request, it says it cannot reuse the address, the socket is in
state TIME_WAIT then.

This is the code I use to make a request:

import xmlrpclib
remote = xmlrpclib.Server("http://localhost:8000")
remote.do_something_nasty()

cg.



More information about the Python-list mailing list