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 */