Socket.setKeepAlive

void setKeepAlive(int time, int interval) @trusted

Enables TCP keep-alive with the specified parameters.

Parameters

timeNumber of seconds with no activity until the first keep-alive packet is sent.
intervalNumber of seconds between when successive keep-alive packets are sent if no acknowledgement is received.

Throws

SocketOSException if setting the options fails, or

SocketFeatureException if setting keep-alive parameters is unsupported on the current platform.