Please enable JavaScript to view this site.

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:

Value

Meaning

> 0

Operation performed successfully. The number of characters sent is returned

0

Waiting for response

-1

Illegal idx

-2

Socket not open

-3

Socket open as server and not as client

-4

buffLen greater than the maximum allowed

-5

No udp_send_notify() results for the specified idx

-6

tOutTot expired

-1000 -:- -2000

Error code of S.O. function sendto(), with offset 1000 (returned error in S.O. function sendto() called to retry transmission after tmOutRx)

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.

 

  

Keyboard Navigation

F7 for caret browsing
Hold ALT and press letter

This Info: ALT+q
Page Header: ALT+h
Topic Header: ALT+t
Topic Body: ALT+b
Contents: ALT+c
Search: ALT+s
Exit Menu/Up: ESC