本人現在在做網路后臺協議,協議本身沒有問題,軟硬體為STM32F207+HAL+LWIP+DP83848。現象是如果在上電的時候沒有插入網線(網線另一端需要連接路由器),等到程式運行后再插入,ip_route_get_local_ip(&pcb->local_ip, &pcb->remote_ip, netif, local_ip)函式無法獲取到本地IP和埠號。
#define ip_route_get_local_ip(src, dest, netif, ipaddr) do { \
(netif) = ip_route(src, dest); \
(ipaddr) = ip_netif_get_local_ip(netif, dest); \
#define ip_route(src, dest) \
ip4_route_src(dest, src)
#define ip_netif_get_local_ip(netif, dest) \
ip4_netif_get_local_ip(netif)
但是如果開始插入網線,即使在后面程序中插拔網線,也不會影響到本地IP的獲取。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/61303.html
標籤:單片機/工控
上一篇:Lvds時鐘眼圖問題請教
下一篇:網站
