IsReachable

TwinCAT TIA
Network Network tools

ns=2;s=DEPRAG Smart/Network/Tools/IsReachable

This command can be used to check the reachability of a specified port at a configured IP address.

Parameters:

    Port
    Port of the HostAddress.
    TimeOutInMilliseconds
    Maximum time in milliseconds (after sending the message) to wait for a response from the host address. If the timeout is exceeded, the check is aborted as unreachable.

Returns:

    IsReachable
    A structure variable of the OpcMethodReturnValueBoolean type. The Result property contains the command-specific return values.
      Result
      A boolean variable that indicates whether the specified port of the specified HostAddress is reachable.

Examples:

In addition to the parameters already explained, the following variables must be created / transferred for the implementation in TwinCAT 3:

Beckhoff parameter:

    bIsReachable
    A boolean variable that can be used to trigger the execution of the IsReachable command.
    OutputDataIsReachable
    An instance of the "ST_BoolOutputData" structure into which the return value of the IsReachable method is written.
    hrIsReachable
    This can be used to monitor the execution of the command. Error codes have the type "HRESULT".
    fbTools
    An instance of the "FB_Tools" function block supplied with the DEPRAG Smart library.
    ConnectionHandle
    "ConnectionHandle" received when establishing a connection between DEPRAG Smart Server and your OPC UA client.


VAR
    bIsReachable  : BOOL;
    OutputDataIsReachable : ST_BoolOutputData;
    hrIsReachable  : HRESULT;
 
    fbTools                  : FB_Tools;
END_VAR

hrIsReachable := fbTools.IsReachable(bIsReachable, depragSmartConnection.ConnectionHandle, '10.10.222.101', 8883, 5000, OutputData => OutputDataIsReachable);
IF hrIsReachable <> S_FALSE THEN 
    bIsReachable := FALSE;
END_IF
                                                    

For examples and explanations regarding the calls of nodes via Siemens TIA Portal please refer to the sub-menu "Siemens TIA Portal" in section "Getting Started".