Please enable JavaScript to view this site.

Function for sending an UDP message to a specified station (nPort and nAddr).

Syntax

i32 udp_send_to (i32 idx, buff, i32 dataLen, u32 rPort, u32 rIp)

idx

Number of the handler of the UDP communication

buff

Generic buffer containing the data packet to be transmitted. 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

dataLen

Number of total bytes to be transmitted

rPort

Number of the remote port to which the data is to be transmitted

rIp

IP address to which to transmit the data

Result

Returns:

Value

Meaning

>= 0

Operation performed successfully. The number of characters sent is returned.

The message is always sent in full, so the number of bytes sent is always equal to dataLen unless there are errors

-1

Invalid port number

-2

Invalid address.

Must be different from 0

-3

Illegal idx

-4

Socket not open

-1000 -:- -2000

Error code of the S.O. function sendto(), with offset 1000

To see some returned errors more specifically, see Returned Error Table

Validity

Rule, Task

Note

The function can be used for client and server communications

For a concrete example see in 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