473,466 Members | 1,351 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 3786

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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.