你好 我尝试在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]
Alvin Chen:
Error [-2] at line [666] in function [CheckLanConnection]
是断开连接了,你加一些延时看看