Connect

TwinCAT TIA
Network TCP/IP client ActiveClients One client

ns=2;s=DEPRAG Smart/Network/TCP/IP/ActiveClients/0/Connect

The command establishes a connection between TCP/IP client and server.

Returns:

    Connect
    A variable of the OpcMethodReturnValueVoid type. The method has no command-specific return values.

Examples:

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

Beckhoff parameter:

    bTcpIpConnect
    A boolean variable that can be used to trigger the execution of the connect command.
    OutputDataTcpIpConnect
    An instance of the ST_VoidOutputData structure into which the return value of the Connect method is written.
    hrTcpIpConnect
    This can be used to monitor the execution of the command. Error codes have the type HRESULT.
    fbTcpIp
    An instance of the "FB_TcpIp" function block supplied with the DEPRAG Smart library.
    sClientId
    A STRING(255) variable representing the ID of the client to be connected.
    ConnectionHandle
    "ConnectionHandle" received when establishing a connection between DEPRAG Smart Server and your OPC UA client.


VAR
   bTcpIpConnect    : BOOL;
   OutputDataTcpIpConnect  : ST_VoidOutputData;
   hrTcpIpConnect    : HRESULT;

   fbTcpIp  : FB_TcpIp;
END_VAR

hrTcpIpConnect := fbTcpIp.Connect(
        bExecute   := bTcpIpConnect, 
        ConnectionHandle := depragSmartConnection.ConnectionHandle, 
        sClientId   := '0', 
        OutputData   => OutputDataTcpIpConnect);
IF hrTcpIpConnect <> S_FALSE THEN 
    bTcpIpConnect := 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".