About W5500 chip send(),recv() Date

Dear all
When I use the W5500 chip, I use the computer as the client (3) and the w5500 as the server (64). I divided buf into send_buf and recv_buf. When I used the network debugging assistant to send data, I found that the data in my recv() was the data I sent.That is, the data in recv_buf is correct. But the data in my send_buf is wrong, sometimes it is garbled.However, when I define buf in both send() and recv() to be the same buf. The data sent at this time is indeed correct. I would like to ask, must the buf of send() and recv() be defined as the same buf?
Looking forward to the official’s answer.

No, it doesn’t have to be the same buffer. Maybe the declaration is wrong?

Thanks for your answer.The first picture below shows the function I wrote. In lines 22 and 23 I split buf into recv_buf and send_buf. Lines 60 and 61. I send the data using the send() and recv() functions, respectively.I use wireshark to capture network packets. Turns out the data I sent to the server was correct. But the data the server sent back to me was wrong.Look at the second picture, the third picture, and the fourth picture.

I think it’s because the two BUFs are defined separately. I send data to the server, so recv_buf receives normal data. send_buf has no data, so the numbers in send_buf are random numbers. But I defined the initial value for send_buf as shown in the fifth figure. But using wireshark to look at the data, it is not the array {1,1,1,1} in this diagram.
What I need to do now is for recv_buf to receive the data and send_buf to send another set of data. I don’t know what to do. I would appreciate it if you could solve my confusion.look forward to your good news.

This is my send function and my receive function.I hope that will be helpful.


Looking forward to hearing from the staff.


Unfortunately, due to company policy, we are unable to support code reviews.
We apologize for the inconvenience, but we hope you’ll take a look at the Loopback example below and fix it.

Thank you for your reply. I solved the problem yesterday.