472,142 Members | 1,210 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,142 software developers and data experts.

SimpleXMLRPCServer

Hi,
the typical usage of SimpleXMLRPCServer registers some
class with the server instance and then jumps into a
serve-forever loop, e.g.

server = SimpleXMLRPCServer(('', 8000))
server.register_instance(MyClass())
server.serve_forever()

is there a way to process actions other than XML-RPC
requests using SimpleXMLRPCServer? Is is possible to do
something like

server = SimpleXMLRPCServer(('', 8000))
server.register_instance(MyClass())
while(1)
if(checkSomeCondidion()):
server.serve_once()
else: server.stop()

thanks,
max
Jul 18 '05 #1
3 3661

Maxim> is there a way to process actions other than XML-RPC requests
Maxim> using SimpleXMLRPCServer? Is is possible to do something like

Maxim> server = SimpleXMLRPCServer(('', 8000))
Maxim> server.register_instance(MyClass())
Maxim> while(1)
Maxim> if(checkSomeCondidion()):
Maxim> server.serve_once()
Maxim> else: server.stop()

You should be able to override the serve_forever() method.

Skip

Jul 18 '05 #2
Here is an example of a server which runs as long as self.running
is set:

class SimpleXMLRPCServer_with_stop(SimpleXMLRPCServer.Si mpleXMLRPCServer):

def __init__(self, *args, **kwds):
self.running = True
SimpleXMLRPCServer.SimpleXMLRPCServer.__init__(sel f, *args, **kwds)

def serve_while_running_is_set(self):
"""Server while running is set."""
while self.running:
self.handle_request()

Skip Montanaro wrote:
Maxim> is there a way to process actions other than XML-RPC requests
Maxim> using SimpleXMLRPCServer? Is is possible to do something like

Maxim> server = SimpleXMLRPCServer(('', 8000))
Maxim> server.register_instance(MyClass())
Maxim> while(1)
Maxim> if(checkSomeCondidion()):
Maxim> server.serve_once()
Maxim> else: server.stop()

You should be able to override the serve_forever() method.

Skip


Jul 18 '05 #3
Bernhard Mulder wrote:
Here is an example of a server which runs as long as self.running
is set:

class SimpleXMLRPCServer_with_stop(SimpleXMLRPCServer.Si mpleXMLRPCServer):

def __init__(self, *args, **kwds):
self.running = True
SimpleXMLRPCServer.SimpleXMLRPCServer.__init__(sel f, *args, **kwds)

def serve_while_running_is_set(self):
"""Server while running is set."""
while self.running:
self.handle_request()

So putting it in my original terms this would be:

server = SimpleXMLRPCServer(('', 8000))
server.register_instance(MyClass())
while(1)
if(checkSomeCondidion()):
server.handle_request()
else: server.stop()

?
thanks.
Jul 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Marco Aschwanden | last post: by
9 posts views Thread by Yannick Turgeon | last post: by
4 posts views Thread by codecraig | last post: by
reply views Thread by Thomas G. Apostolou | last post: by
2 posts views Thread by Laszlo Nagy | last post: by
reply views Thread by Juju | last post: by
3 posts views Thread by Achim Domma | last post: by
9 posts views Thread by Bret | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.