2021-03-21 08:01 AM
Hello,
the default application examples of the netconn and socket server based on lwip doens't
work because the udp and tcp port which are selected randomly (LWIP_RAND() ) could be ouside the autorized ranges (UDP_ENSURE_LOCAL_PORT_RANGE)
hw id: nucleoH723G
fm version :STM32Cube_FW_H7_V1.9.0
app id : LwIP_HTTP_Server_Socket_RTOS & LwIP_HTTP_Server_Netconn_RTOS
The comment of the line #define LWIP_RAND() ((u32_t)rand()) fixes the issue.
/* Define random number generator function */
//#define LWIP_RAND() ((u32_t)rand())
2021-06-17 01:01 AM
Very strangely this also happened to my own application after upgrade to CubeIDE to 1.6.1. I had never before had to comment out #define LWIP_RAND() ((u32_t)rand()) for my application to work. But now yes. Thanks for the tip, it solved my boot issue.
2021-06-20 04:52 AM
As the name suggests UDP_ENSURE_LOCAL_PORT_RANGE() and other similar macros ensures that the port number is correct regardless of value returned by LWIP_RAND(). The real problems are from calling rand() without a proper initialization and support code.