gwPacketSize (Function) |
Top Previous Next |
This function is a part of the Large Packet Support (LPS), and will return the maximum size of a packet that can be sent/received from a peer node connected to the RTCU Communication Hub. It is therefore recommended that this function is only called once for each peer node.
The function requires that the device is connected to the RTCU Communication Hub.
Input: nodeid : DINT The NODE ID of the node.
Returns: INT The maximum number of bytes that can be send to, or received from, the specified node.
Declaration: FUNCTION gwPacketSize : INT;
Example: INCLUDE rtcu.inc incoming : gwReceivePacket; Buf_out : ARRAY [1..4064] OF SINT; size : INT; // Wait for hub connection WHILE NOT gwConnected() DO Sleep(delay := 2000); END_WHILE;
// Determine the maximum size to send size := gwPacketSize(nodeid := 2000); IF size = 0 THEN size := 480; END_IF; ... |