Previous Topic: RemoteTarget.createRemoteContext MethodNext Topic: RemoteTarget.errorOccurred Method


RemoteTarget.destroyRemoteContext Method

This method destroys a context previously created by createRemoteContext(). After destroying a persistent context the RemoteTarget object can still be used in remote execution. Until another context is created, it creates and destroys a context internally for each script evaluation.

This method has the following syntax:

destroyRemoteContext()

The method returns one of the following error codes:

RemoteTarget.REM_ERR_NONE

Indicates success.

RemoteTarget.REM_ERR_DISC

Indicates a disconnection from the remote system.

Example

Create a persistent session, define a variable in the first evaluation and retrieve it in the second one:

rt=new RemoteTarget("ascli1");
if(rt.createRemoteContext()==RemoteTarget.REM_ERR_NONE)
{
    run-remote x=42 on rt
    run-remote x on rt -wait
    ? get-remoteResult(rt)  // 42
    rt.destroyRemoteContext();
    ? get-remoteResult(rt)  // empty
}
else
{
    ? "Error occurred!";
}

See also:

RemoteTarget.createRemoteContext Method