TCP_Send block

Short summary

Name

TCP_Send

→POU type

→function

Category

more system blocks, network blocks, block with internal error diagnostic

→Namespace

logicals.system.network.tcp

Graphical interface

Available since

  • version 3.2.2 (for library Standard) – initial variant
    (warning) This block is supported for these target systems or platforms:

    • Raspberry Pi,  Revolution Pi

    • platform WindowsX86 (incl. the built-in PLC under Windows)

    • platform LinuxX86 

  • version 3.5.0 (for library Standard) – restriction "no function blocks with generic data type"

Functionality

The block sends a →TCP packet.

Inputs, outputs, return value

 

Identifier

→Data type

Description

Inputs:

 

 

lengthOfDataToSend

UDINT

length of the data to send

clientHandle

TCP_ClientHandle

TCP handle

flags

UDINT

additional flags for sending

In-outs
(VAR_IN_OUT):

data

REALLREALUSINTUINTUDINTULINTSINTINTDINTLINTTIMEBOOLBYTEWORDDWORDLWORDSTRINGCHARDATE_AND_TIMEDATETIME_OF_DAY , a →user-defined data type or a →function block
Restriction: In case of →array data types, only one-dimensional arrays are allowed.

Further restriction: In the case of function blocks, no function blocks with a →generic data type are allowed. As a result of this restriction, you cannot use the following blocks as input of the current block: LIMITER_O, LIMITER_U, FORCEMRK, MAX_HOLD, MIN_HOLD, and →vendor-function blocks that have been declared with a generic data type.
If you use instances of these function blocks anyway, a linker error will occur when building the application.

content of the sent TCP packet

Return value:

 (= rc)

TCP_ErrorCode

returns the status of the TCP operation:

succeeded: The operation is successful.

invalidFlags: The flags are invalid.

invalidHandle: The handle is invalid.

cannotSendData: The data cannot be sent.

invalidDataSize: The length of the data is invalid.

Input EN and output ENO are available when →calling the block. See "Execution control: EN, ENO" for information on input EN and output ENO.

See:

Internal error diagnostic for block

The block checks the following error cases:

  • The flags are invalid.

  • The handle is invalid.

  • The data cannot be sent.

  • The length of the data is invalid.

In such an error case, the output ENO of the block is set to value FALSE (or an equivalent). Moreover, the block returns the appropriate code (see the above table).

Example for usage within ST-editor

See "TCP_ServerOpen block".