标签:
#server.py from SimpleXMLRPCServer import SimpleXMLRPCServer def add(x,y): return x+y server=SimpleXMLRPCServer(("10.199.169.37",8088)) print "listening on port 8088..." server.register_multicall_functions() server.register_function(add,‘add‘) server.serve_forever()
#client.py import xmlrpclib proxy=xmlrpclib.ServerProxy("http://10.199.169.37:8088") multicall=xmlrpclib.MultiCall(proxy) multicall.add(7,3) result=multicall() print tuple(result)[0]
结果:
[root@alex01liao-hh-dev-web-gfniv-evhac ~]# python server.py listening on port 8088... vpy-vqnqk.vclound.com - - [10/Feb/2015 23:57:06] "POST /RPC2 HTTP/1.0" 200 -
[root@vpy-vqnqk ~]# python client.py 10
标签:
原文地址:http://www.cnblogs.com/alexkn/p/4285161.html