helge
2021-11-06 81ce32efc7ddebf1f09851d4e4ac34681f436e57
refs
用户 helge <helgewurst@web.de>
星期六, 十一月 6, 2021 22:00 +0800
提交者 helge <helgewurst@web.de>
星期六, 十一月 6, 2021 22:00 +0800
提交81ce32efc7ddebf1f09851d4e4ac34681f436e57
目录 239234d517b30873d463394b505677e46b6af904 目录 | zip | gz
parent b9c30cdba636faf528b4599b62628857303ef583 查看 | 对比
set keep-alive defaults for new connections

Configure scpi-specific keep-alive settings for new connections. Without these, a connection lost on the client side blocks the server baiscally indefinitely, requiring a reset or some means to recover via another port or interface.

scpi server connection timeout is chosen such that when idle, zero window probes are sent periodically, and the connection is closed when they fail SCPI_KEEP_CNT times.

also requires (lwipopts.h):
set #define LWIP_TCP_KEEPALIVE 1

main.c:
add #include "tcp_priv.h"
call tcp_tmr(); every 250 ms (e.g. via xTimerCreate(), xTimerStart() in callback).

To change the defaults for all connections, add these values (lwipopts.h):

#define TCP_KEEPIDLE_DEFAULT 15000UL /* Default KEEPALIVE timer in milliseconds */
#define TCP_KEEPINTVL_DEFAULT 5000UL /* Default Time between KEEPALIVE probes in milliseconds */
#define TCP_KEEPCNT_DEFAULT 3U /* Default Counter for KEEPALIVE probes */
2个文件已修改
11 ■■■■■ 已修改文件
examples/test-LwIP-netconn/scpi_server.c 8 ●●●●● 对比 | 查看 | 原始文档 | blame | 历史
examples/test-LwIP-netconn/scpi_server.h 3 ●●●●● 对比 | 查看 | 原始文档 | blame | 历史