Jump to main content

##

# TCPIP_UDP_Discard Function

## C

    uint16_t TCPIP_UDP_Discard(UDP_SOCKET hUDP);

## Returns

Number of discarded bytes, if any.

## Description

This function discards any remaining received data in the UDP socket.

## Remarks

The UDP socket queues incoming RX packets in an internal queue. This call will discard the remaining bytes (if any) in the current RX packet and will advance the RX packet to be processed to the next queued packet. This function should be normally called after retrieving the available bytes with TCPIP_UDP_ArrayGet. When data available, calling it repeatedly will discard one pending RX packet at a time. Note that a call to TCPIP_UDP_Discard is not needed if all bytes are retrieved with TCPIP_UDP_ArrayGet and then TCPIP_UDP_GetIsReady is called.

## Preconditions

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

## Parameters

Parameters | Description
--- | ---
hUDP | socket handle