W5500 UDP Clearing RX and TX data

Hi I have a question concerning the resetting or clearing of the RX and TX data after a UDP message send or receive.

I have read through the several examples but at present I am closing and opening the socket after a UDP send.

I can receive a UDP message with no problem but I cannot see what is the correct sequence to clear the RX data, pointers and receive bytes ready for the next message without closing or opening a socket.

I assume this is not correct, can anyone help

Regards Andrew

I don’t understand your question.
When receiving data, check the value of Sn_RX_RSR and if it is greater than 0, read Sn_RX_RD to find the pointer address of data, and then read data as much as Sn_RX_RSR. Then, increase the value to Sn_RX_RD as much as read data and transmit the RECV command.
You just need to read Sn_RX_RD every time you receive data, and you don’t need to prepare for the next message.