udpRcvFrom
Description
This function receives a UDP telegram. If the characters are received, the function fills the ADD argument with the internal “UDP” of the sender. This buffer can then be passed to the udpSendTo function to send the answer.
Arguments
Input
En | Description | Execute the function |
Data type | BOOL | |
Range | [0,1] | |
Unit | N/A | |
Default | — | |
sock | Description | ID of the socket |
Data type | DINT | |
Range | [0,+65535] | |
Unit | N/A | |
Default | — | |
nb | Description | Maximum number of characters received |
Data type | DINT | |
Range | [0,+65535] | |
Unit | N/A | |
Default | — | |
add[] | Description | Buffer containing the UDP address of the transmitter (filled on output) |
Data type | USINT | |
Range | [0,32] | |
Unit | N/A | |
Default | — | |
data | Description | Buffer where to store received characters |
Data type | STRING | |
Range | [0,255] | |
Unit | N/A | |
Default | — |
Output
OK | Description | Returns true when the function successfully executes. See Function - General rules. |
Data type | BOOL | |
Unit | N/A | |
Q | Description | Actual number of received characters |
Data type | DINT | |
Unit | N/A |
Examples
Structured Text
ReceivedBytes := udpRcvFrom(Socket_Number,5,add,data); //Read the position
Ladder Diagram
Function Block Diagram