// First, we should enable this macro in lwipopts.h
#define LWIP_TCP_KEEPALIVE 1
// The following code is implemented after tcp_new() or in tcp_connected call back
... xxx_connected(..., struct tcp_pcb* tpcb, ...)
{
tpcb->so_options |= SOF_KEEPALIVE;
tpcb->keep_idle = 5000; // ms
tpcb->keep_intvl = 5000; // ms
tpcb->keep_cnt = 2; // report error after 2 KA without response
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)