Function for receiving a response from a server to a previously sent UDP message.
This call makes sense only after calling the corresponding udp_send_notify() function. The function can only be used for communication from the client.
Syntax |
i32 udp_recv_notify(i32 idx, buff, i32 buffLen, real tOutRx, real tOutTot) |
||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
idx |
Number of the handler of the UDP communication |
||||||||||||||||||||
buff |
Generic buffer intended to contain the received data packet. It can be a string variable, a struct_p (packed structure), or an array of struct_p. In the case of struct_p, the variable must be declared global. If struct, the first member must be declared of type u32 and represents the message identifier msgId; the value is assigned by the udp_send_notify() function. msgId must be used server-side in the response message and is used to ensure routing to the correct client. All other data is for user use. The maximum size of this structure is: MAX_UDP_DATA=508 bytes |
||||||||||||||||||||
buffLen |
Maximum number of bytes to receive (including msgId) |
||||||||||||||||||||
tOutRx |
When this timeout time expires, the message is automatically retransmitted |
||||||||||||||||||||
tOutTot |
When this timeout time expires, the function is aborted. You can call the function with tOutTot=0 to cause the function to be aborted |
||||||||||||||||||||
Result |
Returns:
To see some returned errors more specifically, see Returned Error Table |
||||||||||||||||||||
Validity |
Rule, Task |
||||||||||||||||||||
Note |
The two timeouts will only be able to work correctly if the function is called at a sufficiently high frequency relative to the specified times |
For a concrete example see in the RDE environment: Workspace -> Specials -> Examples Library.