PackRPC

(RPC Manager Library)

Description: Packs an RPC call and a set of parameters into a stream. Subroutine call only.
Returns: BuffStream
Usage: Script Only.
Function Groups: Network,  Stream and Socket
Related to: RunPack
Format: \RPCManager\PackRPC(Stream, ModuleName[, ModContext, Parameters]);
Parameters:  
Stream
Required. The initial packed RPC stream. The RPC specified in this call will be appended onto the end of this stream. If Invalid, a new BuffStream will be created to hold the RPC.
ModuleName
Required. The textual name of the RPC subroutine to be executed. Must be valid.
ModContext
Optional. Specifies the context path from which ModuleName is resolved. If omitted or set to Invalid, the root context ("\") is assumed.
Parameters
Required. A set of up to 32 parameters to the RPC subroutine. Can be any mixture of the legal types. Supplying a parameter of an illegal type will cause it to be replaced with Invalid when the RPC subroutine is invoked.
Comments:

This subroutine is a member of the RPC Manager's Library, and must therefore be prefaced by \RPCManager\, as shown in the "Format" section. If the application is a script application, the subroutine call must be prefaced by System\RPCManager\, and the System variable must be declared in AppRoot.src.
The return value from this method is a BuffStream containing the original contents as specified in the Stream parameter with the new RPC appended. This can be used to build a stream of RPCs for transmission as one atomic unit.

 

The context from which ModContext is searched for depends on how RunPack is invoked:

  • For RPCs contained within a synchronization payload (for example, one generated by GetServerChanges), RunPack is invoked internally with a valid Service parameter. In this case, ModContext is evaluated relative to the module that registered the service via RPCManager.Register().
  • When calling RunPack directly from your code to execute a packed stream of RPCs, the evaluation depends on whether RunPack's Service parameter is valid.
    If Service is valid, ModContext is evaluated relative to the module that registered the service via RPCManager.Register().
    If Service is Invalid, ModContext is evaluated relative to \Code in a VTScada application and relative to \System in a non-VTScada (pure script) application.

RPC Manager Service