SendString

TwinCAT TIA
Network TCP/IP client ActiveClients One client

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

The command sends a string as a TCP/IP message to the server.

Parameters:

    Message
    Content of the message to be sent to the server.

Returns:

    SendString
    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:

    bTcpIpSendString
    A boolean variable that can be used to trigger the execution of the SendString command.
    OutputDataTcpIpSendString
    An instance of the ST_VoidOutputData structure into which the return value of the SendString method is written.
    hrTcpIpSendString
    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.
    sMessage
    A STRING(255) variable representing the message to be sent.
    sClientId
    A STRING(255) variable representing the ID of the client with which the message is to be sent.
    ConnectionHandle
    "ConnectionHandle" received when establishing a connection between DEPRAG Smart Server and your OPC UA client.


VAR
   bTcpIpSendString   : BOOL;
   OutputDataTcpIpSendString : ST_VoidOutputData;
   hrTcpIpSendString   : HRESULT;

   fbTcpIp  : FB_TcpIp;
END_VAR

hrTcpIpSendString := fbTcpIp.SendString(
        bExecute   := bTcpIpSendString, 
        ConnectionHandle := depragSmartConnection.ConnectionHandle, 
        sMessage   := 'Test', 
        sClientId   := '0', 
        OutputData   => OutputDataTcpIpSendString);
IF hrTcpIpSendString <> S_FALSE THEN 
    bTcpIpSendString := 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".