Hi Simon,
Thank you! Your reply has given me more confidence in my test results.
After a lot of tests, I find it stuck because I use an un-thread safe function "udp_send()" outside the tcpip_thread.
I read a lot of the lwip-user archives. They help me a lot.
https://lists.gnu.org/archive/html/lwip-users/2009-05/msg00049.htmlhttps://lists.gnu.org/archive/html/lwip-users/2022-07/msg00012.htmlhttps://lists.gnu.org/archive/html/lwip-users/2010-04/msg00053.html And now I found two ways to resolve the problem.
I would like to ask for your advice about which way is more recommended.
The first method:
Just use LOCK_TCPIP_CORE() and UNLOCK_TCPIP_CORE() to protect the other threads which need to call the LwIP's raw api (such as udp_send()).
The second method:
use the tcpip_try_callback() function in the other threads(outside the tcpip_thread) to post message to tcpip_thread, and when the tcpip_thread handle its message, it will call the according callback function, and then I can call the LwIP's raw api (such as udp_send()) in the callback function which is called by the tcpip_thread.
Both methods have passed my test. They all work well.
Which method is more recommended?
Best regards,
Lan