UDP_Receive block

Short summary

Name

UDP_Receive

→POU type

→function

Category

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

Graphical interface

images/download/thumbnails/414780529/UDP_Receive-version-1-modificationdate-1534501989578-api-v2.png

Available since

  • version 1.105.0 (for logi.CAD 3) and version 3.15.0 of logi.RTS
    images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/warning.svg This block is supported for these →target systems or platforms:

  • version 1.109.0 (for logi.CAD 3) and version 3.19.0 of logi.RTS
    images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/warning.svg 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 2.0.5 (for library Standard) – graphical interface with in-out variable

Functionality

The block receives a →UDP packet.

Inputs, outputs


Identifier

→Data type

Description

Inputs:

handle

DINT

UDP handle

flags

UDINT

additional flags for receiving

In-outs
(VAR_IN_OUT):

data

REAL, LREAL, USINT, UINT, UDINT, ULINT, SINT, INT, DINT, LINT, TIME, BOOL, BYTE, WORD, DWORD, LWORD, STRING, CHAR, DATE_AND_TIME, DATE, TIME_OF_DAY or a →user-defined data type
Restriction: In case of →array data types, only one-dimensional arrays are allowed.

content of received UDP packet

Ausgänge:

sourceAddress

DWORD

source address of the received UDP packet (in network byte order)
Example: The received value 16#0100007F corresponds to the source address 127.0.0.1.

images/s/b2ic8e/9012/1ca6q62/_/images/icons/emoticons/information.svg Use the INET_NTOA block in order to convert the address.

sourcePort

UINT

source port of the received UDP packet (in host byte order)
Example: The received value 1125 corresponds to the source port 1125.

lengthOfReceivedData

UDINT

length of the received UDP packet

rc

UDINT

status of the UDP operation:

  • 16#00000000: The operation is successful

  • 16#81000001: The flag is invalid.

  • 16#81000002: The handle is invalid.

  • 16#81000006: Data cannot be received.

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

Internal error diagnostic for block

The block checks the following error cases:

  • The flag is invalid.

  • The handle is invalid.

  • Data cannot be received.

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

Example for usage within ST-editor

See "UDP_Open block".

When creating your application within the ST-editor, enter a call of a block by typing the text as requested by the syntax or use Content Assist.