def __init__(self, port=0): """Initialize the RPC proxy client. Args: port: The port number the proxy should connect to. Defaults to port zero. """ super(StandardRpcProxyClient, self).__init__( proxy.GetProxyPortNumberFromPID(port)) self._proxy = None
def __init__(self, port=0): """Initialize the RPC proxy. Args: port: The port number the proxy should listen on. Defaults to port zero. """ super(StandardRpcProxyServer, self).__init__( proxy.GetProxyPortNumberFromPID(port)) self._proxy = None
def SetListeningPort(self, new_port_number): """Change the port number the proxy listens to.""" # We don't want to change the port after the proxy has been started. if self._proxy: logging.warning( u'Unable to change proxy ports for an already started proxy.') return self._port_number = proxy.GetProxyPortNumberFromPID(new_port_number)
def SetListeningPort(self, new_port_number): """Change the port number the proxy listens to. Args: new_port_number: the new port number. Raises: RuntimeError: if the proxy is already started. """ if self._proxy: raise RuntimeError( u'Unable to change proxy port since proxy is already started.') self._port_number = proxy.GetProxyPortNumberFromPID(new_port_number)