Function for receiving an UDP message from a server.
The station (nPort and nAddr) was previously specified via an udp_open_client().
|
i32 udp_recv (i32 idx, buff, i32 buffLen)
|
|
Number of the UDP communication handler
|
|
Generic buffer intended to contain the received data packet.
It can be a string variable, struct_p (packed structure), or an array of struct_p. In the case of struct_p, the variable must be declared global
|
|
Maximum number of bytes to receive
|
|
Returns:
|
|
>= 0
|
Operation performed successfully. The number of characters received is returned
|
-1
|
Illegal idx
|
-2
|
Socket not open
|
-3
|
Socket open as server and not as client
|
-1000 -:- -2000
|
Error code of the S.O. function recv(), with offset 1000
|
To see some returned errors more specifically, see Returned Errors Table
|
|
Rule, Task
|
|
The udp_recv() can only be used for client communications
|
For a concrete example see in RDE environment: Workspace -> Specials -> Examples Library.
|
|
-1004
|
[EINTR] Reading was interrupted before any data was received
|
-1009
|
[EBADF] Id invalid
|
-1011
|
[EAGAIN] Retry. Socket was non-blocking and reception would block execution, or a timeout on reception was imposed and that timeout expired before any data was received
|
-1014
|
[EFAULT] Buffer pointer points to a memory area outside the process space
|
-1022
|
[EINVAL] The total I/O length is greater than the maximum that can be represented by the returned type
|
-1088
|
[ENOTSOCK] Invalid id, does not refer to a socket
|
-1105
|
[ENOBUFS] The message was not sent because it would have exceeded the maximum buffer size
|
-1107
|
[ENOTCONN] The connection has not yet been created
|
-1122
|
[EMSGSIZE] Message too long
|
NOTE: For the complete table of error codes see Error codes functions paying attention at the offset.
|