udpReceive (Functionblock) |
Top Previous Next |
This receives data as a connectionless UDP packet from the specified connection. This function block will indicate when data is ready and placed into the receive buffer.
Input: id : SINT ID for the connection as returned by udpStartListen().
data : PTR Address of the buffer that contains the received data.
maxsize : INT Maximum number of bytes that can be received (size of "data"). The maximum size of any UDP package is 1540 bytes. If a data package larger than "maxsize" is received, the data will be truncated but still delivered.
Output: ready : BOOL True if data has been received.
size : INT Number of bytes received (if "ready" is true).
ip : INT IP address of sender (if "ready" is true).
port : DINT IP port of the sender (if "ready" is true).
iface : SINT The network interface where the data was received (if "ready" is true). 1 = Mobile network, 2 = LAN network, etc. (See Network).
Declaration: FUNCTION_BLOCK udpReceive;
Example: INCLUDE rtcu.inc |