Navigation: Scripting Reference Manual > Functions & Subroutines > IPCRecoverConnections

 

IPCRecoverConnections

 

Contact Us: fredsupport@photonengr.com

 

Description

This function attempts to reconnect to remote nodes by searching in the master node's Undo directory (preference setting) for the auto-generated connections snapshot file.  This does not guarantee that FRED will be able to reconnect to any remote nodes or even that the auto-generated snapshot file exists.  If the auto-generated snapshot file does not exist, the function simply returns 0 and prints a message to the output window indicating that the snapshot file could not be found.

 

This command can be useful when a master script has stopped execution without first issuing an IPCTerminate() command.  Such a scenario may occur when the user has pressed the stop button to manually halt the master script, when a script error forces the master script to stop, or if the IPCTerminate() command was simply never included in the master script.

 

Note that recovering the connections to remote nodes is not always necessary, depending on the scenario.  For example, if the master instance of FRED is closed before IPCTerminate() is issued, the remotes will automatically terminate themselves approximately 5-10 minutes after the master instance was closed or once the remotes are idle (whichever comes later).

 

IPCRecoverConnections will fail to recover connections to the remote nodes if IPCDisconnect() and IPCReconnect() have been successfully called prior to IPCRecoverConnections.

 

 

Syntax

count = IPCRecoverConnections( connections() )

 

 

Parameters

count (Long)

Returned number of remote nodes that were recovered and successfully connected to.

 

connections() As T_IPCINSTANCE

An array of T_IPCINSTANCE structures, with each structure defining the connection information for a remote node.  This array will be overwritten with the contents of the auto-generated snapshot file if one is found.

 

 

Example

The example below demonstrates how to try using the auto-generated snapshot file to recover the connections to remote nodes.

 

Sub Main

 

    'Attempt to recover using the auto-snapshot

    'This does not guarantee the ability to re-connect

    Dim nReconnect As Long

    Dim connections() As T_IPCINSTANCE

    nReconnect = IPCRecoverConnections( connections() )

 

    'Did we recover any connections?

    If nReconnect < 1 Then

        Print "No reconnections to remote nodes were successful.  Stopping script."

        End

    End If

 

    'Query the status again

    Dim nQuery

    nQuery = IPCQueryStatus( connections(), "detail" )

 

    'Terminate the connections

    Dim nTerminate As Long

    nTerminate = IPCTerminate( connections(), "force sterilize", "" )

 

End Sub

 

The IPC commands generally report information to the output window that may be used as diagnostics.  For the example script shown above, the following output is reported in the case where orphaned remote FRED instances are available for reconnection.

 

[MASTER]IPCRecoverConnections:  3 of 3 connections read from 'c:\temp\AutoSavedConnections.csv'                                                                      

                                                                      

          index          active                    speed          host                    status          

          1          true                    100          computer1          connected          

          2          true                    100          computer2          connected          

          3          true                    100          computer3          connected          

                                                                      

                                                                      

[MASTER]IPCQueryStatus:  3 connections queried                                                                      

                                                                      

          index          host                    message                              

          1          computer1          idle                              

          2          computer2          idle                              

          3          computer3          idle                              

                                                                      

          index          host handle           cmd handle                    message          

          1          NI_00000006           HPOL                              check          

                                         PING                              

                                         IDLE                              idle          

                                         OP_00000003                    finished   \\computer2\users\public\documents\fred_remote\XFERFILES_lh_20160118140513_00000002.txt

                                         OP_00000002                    finished          

                                         OP_00000001                    FD_00000000          

                                         OP_00000000                    finished   finished          

                                         LongCalc                              

          2          NI_00000007           HPOL                              check          

                                         PING                              

                                         IDLE                              idle          

                                         OP_00000003                    finished   \\computer2\users\public\documents\fred_remote\XFERFILES_lh_20160118140513_00000002.txt

                                         OP_00000002                    finished          

                                         OP_00000001                    FD_00000000          

                                         OP_00000000                    finished   finished          

                                         LongCalc                              

          3          NI_00000008           HPOL                              check          

                                         PING                              

                                         IDLE                              idle          

                                         OP_00000003                    finished   \\computer2\users\public\documents\fred_remote\XFERFILES_lh_20160118140514_00000002.txt

                                         OP_00000002                    finished          

                                         OP_00000001                    FD_00000000          

                                         OP_00000000                    finished   finished          

                                         LongCalc                              

                                                                      

                                                                      

[MASTER]IPCTerminate:  3 of 3 Remote FRED instance terminations initiated                                                                      

                                                                      

          index          host                    message                              

          1          computer1          terminate - initiated                              

          2          computer2          terminate - initiated                              

          3          computer3          terminate - initiated                              

 

 

See Also

Distributed Computing Script Commands

T_IPCINSTANCE

 

 

 

 

 

Copyright © Photon Engineering, LLC