Server
- class compas.rpc.Server[source]
Bases:
SimpleXMLRPCServer
Version of a SimpleXMLRPCServer that can be cleanly terminated from the client side.
Notes
This class has to be used by a service to start the XMLRPC server in a way that can be pinged to check if the server is alive, and can be cleanly terminated.
Examples
# service.py from compas.rpc import Server from compas.rpc import Dispatcher class DefaultService(Dispatcher): pass if __name__ == "__main__": server = Server(("localhost", 8888)) server.register_function(server.ping) server.register_function(server.remote_shutdown) server.register_instance(DefaultService()) server.serve_forever()
Methods
Simple function used to check if a remote server can be reached.
Stop the server through a call from the client side.
Inherited Methods
Called to clean up an individual request.
Return socket file number.
Finish one request by instantiating RequestHandlerClass.
Get the request and client address from the socket.
Handle an error gracefully.
Handle one request, possibly blocking.
Called if no new request arrives within self.timeout.
Call finish_request.
Registers a function to respond to XML-RPC requests.
Registers an instance to respond to XML-RPC requests.
Registers the XML-RPC introspection methods in the system namespace.
Registers the XML-RPC multicall method in the system namespace.
Handle one request at a time until shutdown.
Called by constructor to activate the server.
Called by constructor to bind the socket.
Called to clean-up the server.
Called by the serve_forever() loop.
Stops the serve_forever loop.
Called to shutdown and close an individual request.
system.listMethods() => ['add', 'subtract', 'multiple']
system.methodHelp('add') => "Adds two integers together"
system.methodSignature('add') => [double, int, int]
system.multicall([{'methodName': 'add', 'params': [2, 2]}, ...]) => [[4], ...]
Verify the request.