|
ThreadX NetXDUO网络协议栈 DHCP一直获取不到IP,一直在nx_ip_status_check里等待
/* 创建DHCP实例 */
status = nx_dhcp_create(&dhcp_ptr, &ip_0, "DHCP Client");
if (status != NX_SUCCESS) error_counter++;
/* Register state change variable. */
status = nx_dhcp_state_change_notify(&dhcp_ptr, dhcp_state_change);
if (status) error_counter++;
/* 启动DHCP客户端来获取IP地址 */
status = nx_dhcp_start(&dhcp_ptr);
if (status != NX_SUCCESS) error_counter++;
/* 等待DHCP客户端获取IP地址 */
/* Wait for DHCP to assign the IP address. */
do
{
/* Check for address resolution. */
status = nx_ip_status_check(&ip_0, NX_IP_ADDRESS_RESOLVED, (ULONG *) &actual_status, NX_IP_PERIODIC_RATE);
/* Check status. */
if (status)
{
/* wait a bit. */
tx_thread_sleep(NX_IP_PERIODIC_RATE);
}
} while (status != NX_SUCCESS);
|
|