ConnectToMachine
(RPC Manager Library)
Description: | This subroutine increments the usage count on the specified workstation and forces RPC Manager to attempt to establish a connection with the specified workstation if it is not already connected. Subroutine call only. |
Returns: | Socket node (warning - see note in comments) |
Usage: | Script Only. |
Function Groups: | Network |
Related to: | DisconnectFromMachine | GetServer | GetServersListed | GetStatus | IsClient | IsPotentialServer | IsPrimaryServer | Register (RPC Manager) | Send | SetRemoteValue |
Format: | \RPCManager\ConnectToMachine(Workstation) |
Parameters: |
Workstation |
Required. Any text expression giving the name or IP address of the workstation to which the connection is to be made. |
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 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. While the usage count of the workstation is non-zero, RPC Manager will continue to attempt to establish a connection to the remote workstation. It is critical that each ConnectToMachine call should be paired with a DisconnectFromMachine call. If the number of ConnectToMachine calls exceeds the number of DisconnectFromMachine calls, the RPC Manager will not behave as expected and disconnection from the remote workstation may be impeded. An unexpectedly positive value for the Srv value in the socket's entry in the RPC Diagnostics Window may be an indication of a ConnectToMachine/DisconnectFromMachine mismatch. This subroutine doesn't return a (reliable) socket node (i.e. may go invalid). Also, it isn't a socket, it is a socket node instance. |
Example:
If ! TryToOpen; [ TryToOpen = 1; SNode = \RPCManager\ConnectToMachine("TestMachine"); ] If SNode.SocketOpen Continue;
This code snippet opens a socket to the workstation called TestMachine and waits until the connection has been established before continuing.
Refer to RPC Manager Service for a listing of Service Control Methods, RPC Methods, and Deprecated RPC Methods.