RPC.DISCONNECT function

Syntax

RPC.DISCONNECT (connection.ID)

Description

Use the RPC.DISCONNECT function to end an RPC session.

connection.ID is the RPC server connection you want to close.

RPC.DISCONNECT sends a request to end a connection to the server identified by connection.ID. When the server gets the request to disconnect, it performs any required termination processing. If the call is successful, RPC.DISCONNECT returns 1. If an error occurs, RPC.DISCONNECT returns 0.

Use the STATUS function after an RPC.DISCONNECT function is executed to determine the result of the operation, as follows:

81001
The connection was closed, reason unspecified.
81002
connection.ID does not correspond to a valid bound connection.
81009
Unspecified RPC error.

Example

The following example closes the connection to a remote server called MONITOR on HOST.A:

MAT args(1,2), res(1,2)
server.handle = RPC.CONNECT ("HOST.A", "MONITOR")
IF (server.handle = 0) THEN
   PRINT "Connection failed, error code is: ": 
STATUS()
   STOP
END
   .
   .
   .
close.connection:
IF (RPC.DISCONNECT (server.handle)) ELSE
   PRINT "Bizarre disconnect error, result code is: " 
STATUS()
END