Considere este exemplo de Python3
.
Servidor A :
#!/usr/bin/env python3
# coding=utf8
from subprocess import check_call
from xmlrpc.server import SimpleXMLRPCServer
from xmlrpc.server import SimpleXMLRPCRequestHandler
# Restrict to a particular path
class RequestHandler(SimpleXMLRPCRequestHandler):
rpc_paths = ('/JRK75WAS5GMOHA9WV8GA48CJ3SG7CHXL',)
# Create server
server = SimpleXMLRPCServer(
('127.0.0.1', 8888),
requestHandler=RequestHandler)
# Register your function
server.register_function(check_call, 'call')
# Run the server's main loop
server.serve_forever()
Servidor B :
#!/usr/bin/env python3
# coding=utf8
import xmlrpc.client
host = '127.0.0.1'
port = 8888
path = 'JRK75WAS5GMOHA9WV8GA48CJ3SG7CHXL'
# Create client
s = xmlrpc.client.ServerProxy('http://{}:{}/{}'.format(host, port, path))
# Call your function on the remote server
s.call(['alarm'])