服务端程序在Python中怎么实现?
提问人:杨紫红发布时间:2020-11-17
from SimpleXMLRPCServer import SimpleXMLRPCServer
def msg(s):
print s
return True
server = SimpleXMLRPCServer( ("localhost", 8000) )
server.register_function(msg)
server.serve_forever()
对应的客户机程序:
from xmlrpclib import ServerProxy
server = ServerProxy("http://localhost:8000")
while True:
msg = raw_input()
server.msg(msg)
继续查找其他问题的答案?
相关视频回答
回复(0)
点击加载更多评论>>