473,383 Members | 1,837 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 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 3776

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Marco Aschwanden | last post by:
I would like to develop a server based on python's xmlrpc. But I realized that SimpleXMLRPCServer does not spawn a thread for each request. How could the SimpleXMLRPCServer be turned into a...
9
by: Yannick Turgeon | last post by:
I plan to use XML-RPC to communicate between my python server and VB client. I just called a simple registered function (lambda x,y: x+y) and it worked. But I'm new to XML-RPC and I'm now wondering...
4
by: codecraig | last post by:
Hi, I thought I posted this, but its been about 10min and hasnt shown up on the group. Basically I created a SimpleXMLRPCServer and when one of its methods gets called and it returns a response...
0
by: Thomas G. Apostolou | last post by:
Hello all, I use Python 2.3.3 and try to patch SimpleXMLRPCServer.py with the patch i got from Python.org. so after changing to the directory where both SimpleXMLRPCServer.py and...
0
by: JDF | last post by:
I am trying to create a Windows service using SimpleXMLRPCServer and win32serviceutil. The service itself seems to be working properly (starts, stops, etc) and I can connect using an XMLRPC client...
2
by: Laszlo Nagy | last post by:
Hello, I ran in the same problem again. Many others have the same problem. Just Google for this: "SimpleXMLRPCServer allow_none site:python.org". Looks like the 'allow_none' patch was commited...
0
by: Juju | last post by:
Hi, First, sorry for my poor English ! I used the SimpleXMLRPCServer facility of Python to develop a multithread-server, here's part of my code : -- class...
3
by: Achim Domma | last post by:
Hi, is SimpleXMLRPCServer multithreaded or how does it handle multiple clients? I want to implement a simple server which will be queried by multiple processes for work to be done. The server...
9
by: Bret | last post by:
I'm coming back to Python after an absence and it's surprising how many things I've forgotten since wandering (against my will) into Java land. Anyway, I have a need for a way to make...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.