服务端:
from SocketServer import ThreadingMixln
from SimpleXMLRPCServer import SimpleXMLRPCServer
class ThreadXMLRPCServer(ThreadingMixln, SimpleXMLRPCServer):
pass
def register_fun():
pass
server = ThreadXMLRPCServer(('', 8899), allow_none = True)
server.register\_function(register\_fun)
print 'Listening on 8899 ...'
server.serve_forever()
客户端:
from xmlrpclib import ServerProxy
print 'Connect to server ...'
proxy = ServerProxy('http://localhost:8899')
proxy.register_fun()