udpSendToVar
Description
This function sends the contents of a local variable to another controller. This allows for the exchange of data across controllers.
-
-
Limitations:
- Function A function calculates a result according to the current value of its inputs. A function has no internal data and is not linked to declared instances. block instance variable types are not supported.
- The following types of variables cannot be sent or received:
- Variables defined with a UDFB "User Defined Function Block" UDFB can be used as a sub-function block in another program of the application. It is described using FBD, LD, ST or IL language. Input / output parameters of a UDFB (as well as private variables) are declared in the variable editor as local variables of the UDFB.
- The Input and Output variables defined for a sub-program.
- udpSendToVar and udpRcvFromVar will not automatically swap bytes for big vs. little endian systems.
- Send / receive between a Simulator and PDMM/PCMM is not supported.
- 3rd party stand-alone programs on x86 platforms are responsible for endian conversions for UDP telegrams from a PDMM/PCMM.
Arguments
Input
En | Description | Execute the function |
Data type | BOOL | |
Range | [0,1] | |
Unit | N/A | |
Default | — | |
sock | Description | Socket number, return value from udpCreate |
Data type | DINT | |
Range | [0,+65535] | |
Unit | N/A | |
Default | — | |
add[] | Description | Array which contains information about the sender (server) of information. This includes the sender's IP address. |
Data type | USINT | |
Range | [0,32] | |
Unit | N/A | |
Default | — | |
varName | Description | The name of a variable (or array or structure) to send to the receiver. The variable should be the same type as what is expected by the receiver. See udpRcvFromVar. |
Data type | ||
Range | ||
Unit | N/A | |
Default | — |
Output
OK | Description | Returns true when the function successfully executes. See Function - General rules. |
Data type | BOOL | |
Unit | N/A |
Examples
Structured Text
udpSendToVar( Socket_Number, Add, MyUDPVar )
Ladder Diagram
Function Block Diagram