Register (RPC Manager)

(RPC Manager Library)

Description This subroutine registers a service for RPC and returns a pointer to the variable containing the current RPC status of the service.
Returns Pointer containing the current RPC status.
Usage Script Only. (Subroutine call only)
Function Groups Network
Related to: ConnectToMachine | DisconnectFromMachine | GetServer | GetServersListed | GetStatus | IsClient | IsPotentialServer | IsPrimaryServer | Send | SetRemoteValue
Format: \RPCManager\Register(ServiceName [, ListSource, ListName, SemObj, StartMode, PrioritySync, ServerList, Sticky])
Parameters  
ServiceName
Required. The name of the tag to register.
ListSource

The object that is the source of this service's server list. Should have the following callbacks (like LayerModule):

  • ServerListSubscribe
  • ServerListUnsubscribe
  • GetServerList
  • GetRPCServiceSettings

Defaults to Layer object with this service's LocalGUID.

ListName

Name of the server list to use for this service.

If invalid, the section name will be ServiceName.

If ListSource is a Layer, then the list used follows the following rules of precedence: service and workstation-specific list, service-specific list, workstation-specific list, then default server list.

If no lists can be found at all, this machine is assumed to be the sole server.

SemObj
An object value for an instance of the system Semaphore module. If Invalid, the RPC Manager will launch an instance of Semaphore for this service.
StartMode

The mode that the service instance will start up in or become when it loses its connection to the server instance. The mode of a service determines whether the RPC Manager transmits service broadcast messages from the server. You should supply the constant \RPC_ACCEPT_ALL (default) if your service requires no synchronization whatsoever. Otherwise, set it to \RPC_SYNC_MODE.

Set TRUE to prevent server from sending Broadcast messages to us.

PrioritySync
When set to non-zero, the PrioritySync flag prevents higher priority servers from syncing with lower priority servers, forcing the lower server to synchronize with itself. Most system services do not set this flag.
ServerList
An optional parameter that is an array of server names for this service. If used, it overrides any server list configuration that has been done in the .RPC files. If not used, the usual method of determining the server list is used.
Sticky
An optional flag that causes this service to stick to a server, even if a higher order server comes online (see also sticky status).
Comments Subroutine call only.
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 you are developing 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 call is a pointer to a variable that contains the current RPC status of this service instance. Dereferencing this pointer will yield one of the following values
0 - the status of the service instance is unknown at this time.
1 - this service instance is a client to another service instance.
2 - this service instance is the server instance.
Invalid - the caller of Register() has been slain.

This value will almost certainly be required by the service instance's code to allow it to operate correctly.

The ServiceLayer parameter is almost always used for system-level services (services that don't run within running applications). Unless writing a system-level service, leave this parameter as invalid and set the server list via the Edit Server Lists panel of the application properties GUI.

Refer to "API Reference" for a listing of Service Control Methods, RPC Methods, and Deprecated RPC Methods.