Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SimpleXMLRPCServer and forking

Status
Not open for further replies.

cmay4

Programmer
Mar 7, 2001
2
US
I have a couple of questions concerning the SimpleXMLRPCServer.

1. I'm trying to implement a situation where the web client makes a call to the XML-RPC server, a database is updated showing that a job is beginning to run, and the server returns success to the calling user. After the request completes, the job (which takes a long time) starts to
run and completes. Upon completion, the results are posted into the database. Here is some very simple code that illustrates what I am talking about:

Code:
   import SimpleXMLRPCServer, sys, socket

   class Functions:
       def _logon(self, user, db):
    	    # handle user verification

       def dump(self, user, db, request):
           _logon(user, db)
           # return success
           # continue long running request

   if __name__ == '__main__':
       server = SimpleXMLRPCServer.SimpleXMLRPCServer((localhost, 8000))
       server.register_instance(Functions())
       server.serve_forever()

Does anyone know the best way to handle that? Should I use a fork() in the dump function? I'm not sure how that will affect the XML-RPC server though. I could call an external program and launch it as a background process, but I'd like to keep the code self-contained.

2. Am I correct in saying that SimpleXMLRPCServer can only process a single request at a time? It doesn't appear to be using the forking model. If that is the case, does anyone know an easy way to create a forking version? I could copy the source code and make some changes, but I was wondering if there was a way to subclass instead.

Thanks for any help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top