Python远程方法调用 rpyc
server.py
-----------------------------------------------
# coding=utf-8
import time
from rpyc import Service
from rpyc.utils.server import ThreadedServer
class TimeService(Service):
def exposed_sum(self,a,b):
return a+b
s=ThreadedServer(TimeService,port=12233,auto_register=False)
s.start()
client.py
-----------------------------------------------
# coding=utf-8
import rpyc
c=rpyc.connect('localhost',12233)
print c.root.sum(1,2)
c.close()