本帖最后由 beli 于 2019-10-19 20:17 编辑
问题描述:我在使用TCP_Server例子时,如果直接把网线拔掉就会报以下错误,然后死机。而使用PC端的网络调试助手不断的断开,连接就没有问题。请问RTT中怎么处理拔网线这种情况呢。[img=110,0][/img]因为板子是直接连的路由器(它会时不时的掉电重启,这就和把网线是一样的效果,所以必须处理好这个情况);报错代码如下:
[32m[I/drv.emac] link down[0m
rt_mb_recv returned with error!
Assertion: 531 in ..\..\..\components\net\lwip-2.1.0\src\arch\sys_arch.c, thread tcprx
(0) assertion failed at function:sys_arch_assert, line number:637
send error,close the socket.
还有就是RT_USING_MODULE这个定义的作用是?程序进了这个断言
void rt_assert_handler(const char *ex_string, const char *func, rt_size_t line)
{
volatile char dummy = 0;
if (rt_assert_hook == RT_NULL)
{
#ifdef RT_USING_MODULE
if (dlmodule_self())
{
/* close assertion module */
dlmodule_exit(-1);
}
else
#endif
{
rt_kprintf("(%s) assertion failed at function:%s, line number:%d \n", ex_string, func, line);
while (dummy == 0);
}
}
else
{
rt_assert_hook(ex_string, func, line);
}
}
RTM_EXPORT(rt_assert_handler);
查看更多