SendByte

TwinCAT TIA
Network TCP/IP client ActiveClients One client

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

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

Parameters:

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

Returns:

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

    bTcpIpSendByte
    A Boolean variable that can be used to trigger the execution of the SendByte command.
    OutputDataTcpIpSendByte
    An instance of the ST_VoidOutputData structure in which the return value of the SendByte method is written.
    hrTcpIpSendByte
    This can be used to monitor the execution of the command. Error codes have the type HRESULT.
    Message
    A variable of type "ARRAY[*] OF BYTE" in which the message to be sent is stored.
    fbTcpIp
    An instance of the "FB_TcpIp" function block supplied with the DEPRAG Smart library.
    nMessageLength
    A UINT variable that specifies the length of the message.
    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
   bTcpIpSendByte    : BOOL;
   OutputDataTcpIpSendByte  : ST_VoidOutputData;
   hrTcpIpSendByte    : HRESULT;
   testLongByteArray : ARRAY[1..1000] OF BYTE := [84, 101, 115, 116, 255, 84, 255];

   fbTcpIp  : FB_TcpIp;
END_VAR

hrTcpIpSendByte := fbTcpIp.SendByte(
        bExecute   := bTcpIpSendByte, 
        ConnectionHandle := depragSmartConnection.ConnectionHandle, 
        nMessageLength  := 7, 
        sClientId   := '0', 
        Message    := testLongByteArray, 
        OutputData   => OutputDataTcpIpSendByte);
IF hrTcpIpSendByte <> S_FALSE THEN 
    bTcpIpSendByte := 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".