def __init__(self, bindaddr): SimpleTCPServer.__init__(self, bindaddr, MyServerRequestHandler) self.register_function(ping) self.register_function(mount) self.register_function(iostat) self.register_function(uptime) self.register_function(get_env) self.register_function(netstat) self.register_function(cpuinfo) self.register_function(meminfo) self.register_function(ifconfig) self.register_function(disk_usage) self.register_function(check_process) self.register_function(running_process)
def __init__(self, bindaddr): SimpleTCPServer.__init__(self, bindaddr) self.register_function( ping ) self.register_function( blah )
import ssl from jrpc import SimpleTCPServer as Server def ping(): return "pong" def blah(a): return a if __name__ == "__main__": HOST, PORT = "localhost", 9999 server = Server((HOST, PORT)) server.socket = ssl.wrap_socket(server.socket, keyfile="key.pem", certfile="cacert.pem", server_side=True) server.register_function(ping) server.register_function(blah) server.serve_forever()
#!/usr/bin/env python from jrpc import SimpleTCPServer as Server def ping(): return "pong" def blah(a): return a if __name__ == "__main__": HOST, PORT = "localhost", 9999 server = Server((HOST, PORT)) server.register_function( ping ) server.register_function( blah ) server.serve_forever()