Is there any way to make multiple calls from an xmlrpc client to different xmlrpc servers at a time.
My Server code looks like this: (I'll have this code runnning in two machines, server1 & server2)
class TestMethods(object):
def printHello(self):
while(1):
time.sleep(10)
print "HELLO FROM SERVER"
return True
class ServerThread(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
self.server = SimpleXMLRPCServer(("x.x.x.x", 8000))
self.server.register_instance(TestMethods())
def run(self):
self.server.serve_forever()
server = ServerThread()
server.start()
My Client code looks like this:
import xmlrpclib
client1 = xmlrpclib.ServerProxy("http://x.x.x.x:8080") # registering with server 1
client2 = xmlrpclib.ServerProxy("http:/x.x.x.x:8080") # registering with server 2
ret1 = client1.printHello()
ret2 = client2.printHello()
Now, on the 10th second I'll get a response from server1 and on the 20th second I'll get a response from server2 which is unfortunately not what I want. I'm trying to make calls to two machines at a time so that I get the response back from those two machines at a time.
PLease help me out, THanks in advance.