473,909 Members | 4,735 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SimpleXMLRPCSer ver

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

server = SimpleXMLRPCSer ver(('', 8000))
server.register _instance(MyCla ss())
server.serve_fo rever()

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

server = SimpleXMLRPCSer ver(('', 8000))
server.register _instance(MyCla ss())
while(1)
if(checkSomeCon didion()):
server.serve_on ce()
else: server.stop()

thanks,
max
Jul 18 '05 #1
3 3854

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

Maxim> server = SimpleXMLRPCSer ver(('', 8000))
Maxim> server.register _instance(MyCla ss())
Maxim> while(1)
Maxim> if(checkSomeCon didion()):
Maxim> server.serve_on ce()
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 SimpleXMLRPCSer ver_with_stop(S impleXMLRPCServ er.SimpleXMLRPC Server):

def __init__(self, *args, **kwds):
self.running = True
SimpleXMLRPCSer ver.SimpleXMLRP CServer.__init_ _(self, *args, **kwds)

def serve_while_run ning_is_set(sel f):
"""Server while running is set."""
while self.running:
self.handle_req uest()

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

Maxim> server = SimpleXMLRPCSer ver(('', 8000))
Maxim> server.register _instance(MyCla ss())
Maxim> while(1)
Maxim> if(checkSomeCon didion()):
Maxim> server.serve_on ce()
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 SimpleXMLRPCSer ver_with_stop(S impleXMLRPCServ er.SimpleXMLRPC Server):

def __init__(self, *args, **kwds):
self.running = True
SimpleXMLRPCSer ver.SimpleXMLRP CServer.__init_ _(self, *args, **kwds)

def serve_while_run ning_is_set(sel f):
"""Server while running is set."""
while self.running:
self.handle_req uest()

So putting it in my original terms this would be:

server = SimpleXMLRPCSer ver(('', 8000))
server.register _instance(MyCla ss())
while(1)
if(checkSomeCon didion()):
server.handle_r equest()
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
4816
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 multi-threaded Server? Is there a reason why the SimpleXMLRPCServer is not multi-threaded? Is there a plan to make it multi-threaded? Thanks for any hints in advance,
9
785
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 why this class is called "Simple". What are its limitations? I want to know if I can count on it for my project or if I would need a not-so-simple XML-RPC server. Yannick
4
2349
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 to the client, the server prints some info out to the console, such as, localhost - - "POST /RPC2 HTTP/1.0" 200 - Anyhow, is there a way I can surpress that so its not printed to the
0
1197
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 SimpleXMLRPCServer.patch reside i run : patch -i SimpleXMLRPCServer.patch -b --verbose --dry-run SimpleXMLRPCServer.py and i get : Hmm...patch: **** unexpected end of hunk at line 47
0
2010
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 from the localhost. However when I connect from a remote client, I either get a socket error or an xmlrpclib.ProtocolError error. If I use serve_forever() rather than handle_request(), the remote clients can connect but it breaks the Windows...
2
3140
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 to trunk on 2005 Dec ( http://mail.python.org/pipermail/python-checkins/2005-December/048289.html ) I just upgraded to Python 2.4.3 (it was released on March 29, 2006) and SimpleXMLRPCServer.py still has the old code. I can work around this by...
0
1228
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 TotoSimpleXMLRPCServer(SocketServer.ThreadingMixIn, SimpleXMLRPCServer.SimpleXMLRPCServer):
3
7259
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 will simply hold a queue with files to process. The clients will ask for the next file. Do I have to sync access to the queue or is the server not threaded at all? regards,
9
3282
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 SimpleXMLRPCServer interruptable. Basically, I have a main server that, in response to certain RPC calls, creates additional servers on different ports. I then need to be able to shut these additional servers down. I've got something like this in the...
0
11346
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10919
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10538
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7248
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5938
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6138
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4774
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 we have to send another system
2
4336
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3357
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.