TCPIP_UDP_ArrayPut Function

C

uint16_t TCPIP_UDP_ArrayPut(UDP_SOCKET hUDP, const uint8_t * cData, uint16_t wDataLen); 

Returns

The number of bytes successfully placed in the UDP transmit buffer. If this value is less than wDataLen, then the buffer became full and the input was truncated.

Description

This function writes an array of bytes to the UDP socket, while incrementing the socket write pointer. TCPIP_UDP_PutIsReady should be used before calling this function to verify that there is room in the socket buffer.

Remarks

The return value could be 0 if there is no TX buffer available (for example the socket has TX data queued and the TCPIP_UDP_PutIsReady has not been called or the TX buffer allocation failed). The return value could be < than wDataLen depending on the size and the available space of the socket TX buffer

Preconditions

UDP socket should have been opened with TCPIP_UDP_ServerOpen/TCPIP_UDP_ClientOpen. hUDP - valid socket cData - valid pointer

Parameters

ParametersDescription
hUDPUDP socket handle
cDataThe array to write to the socket.
wDataLenNumber of bytes from cData to be written.