TsgcTCPClient › Properties › TCPKeepAlive

TCPKeepAlive Property

Enables OS-level TCP keep-alive probes on the client socket.

Syntax

property TCPKeepAlive: TsgcTCPKeepAlive read FTCPKeepAlive write SetTCPKeepAlive;

Default Value

Enabled=False, Time=7200000, Interval=1000

Remarks

When TCPKeepAlive.Enabled is True the transport turns on the socket SO_KEEPALIVE option via SetKeepAliveValues. Time is the idle period in milliseconds before the kernel starts probing (default 7200000, i.e. 2 hours) and Interval is the spacing between probes in milliseconds (default 1000). These probes are handled by the operating-system TCP stack and are independent from the application-level HeartBeat property — use TCPKeepAlive when you want a protocol-agnostic way to detect dead peers on the raw TCP channel.

Example


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;

Back to Properties