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