TsgcTCPClient › Properties › TCPKeepAlive
Abilita le sonde TCP keep-alive a livello OS sul socket del client.
property TCPKeepAlive: TsgcTCPKeepAlive read FTCPKeepAlive write SetTCPKeepAlive;
Enabled=False, Time=7200000, Interval=1000
Quando TCPKeepAlive.Enabled è True il trasporto attiva l'opzione del socket SO_KEEPALIVE tramite SetKeepAliveValues. Time è il periodo di inattività in millisecondi prima che il kernel inizi a sondare (valore predefinito 7200000, ovvero 2 ore) e Interval è l'intervallo tra le sonde in millisecondi (valore predefinito 1000). Queste sonde vengono gestite dallo stack TCP del sistema operativo e sono indipendenti dalla proprietà HeartBeat a livello applicativo — utilizzi TCPKeepAlive quando desidera un modo indipendente dal protocollo per rilevare i peer non più attivi sul canale TCP raw.
oTCP := TsgcTCPClient.Create(nil);
oTCP.Host := 'www.esegece.com';
oTCP.Port := 2053;
oTCP.TCPKeepAlive.Time := 60000;
oTCP.TCPKeepAlive.Interval := 5000;
oTCP.TCPKeepAlive.Enabled := true;
oTCP.Active := true;