This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

在wifi station的例程中 checklanconnection 里面多次ping网关 第三次失败

你好 我尝试在wifi station例程中 ping网关的代码中 加入while循环 去实现 多次ping 网关

为什么在执行第三次的时候 就提示失败了

代码如下:

while(1)
{
i++;
Report("start ping test %d\n\r", i);
// Check for LAN connection
lRetVal = sl_NetAppPingStart((SlPingStartCommand_t*)&pingParams, SL_AF_INET,
(SlPingReport_t*)&pingReport, SimpleLinkPingReport);
ASSERT_ON_ERROR(lRetVal);

// Wait for NetApp Event
while(!IS_PING_DONE(g_ulStatus))
{
#ifndef SL_PLATFORM_MULTI_THREADED
_SlNonOsMainLoopTask();
#endif
}
Report("get ping test packet %ld\n\r", g_ulPingPacketsRecv);

if(0 == g_ulPingPacketsRecv)
{
//Problem with LAN connection
ASSERT_ON_ERROR(LAN_CONNECTION_FAILED);
}
}

错误信息:


Pinging...!
start ping test 1
get ping test packet 3
start ping test 2
get ping test packet 3
start ping test 3
Error [-2] at line [666] in function [CheckLanConnection]