다음은 간단한 예제.
~cpp
#xmlrpctest.py
import SocketServer
import xmlrpcserver
import xmlrpclib
class MyRequestHandler(xmlrpcserver.RequestHandler):
#Override method:
def call(self, method, params):
print "Dispatching: " , method, params
try:
server_method = getattr(self, method)
except:
raise AttributeError, "No XML-RPC procedure %s" % method
return server_method(params)
def test(self, k):
return k[0]+1
def dumptest(self, params):
return xmlrpclib.dumps(params)
if __name__=='__main__':
server = SocketServer.TCPServer(('', 8000), MyRequestHandler)
server.serve_forever ()
Thread ¶
신기하다. 이글루스에 바로 글쓰기가 되네. - 임인택