Function vector::net::set_keepalive
source · pub fn set_keepalive(socket: &TcpStream, ttl: Duration) -> Result<()>
Expand description
Sets the TCP keepalive behavior on a socket.
This is the equivalent of setting the SO_KEEPALIVE
and TCP_KEEPALIVE
socket settings
directly.
§Errors
If there is an error with either enabling keepalive probes or setting the TCP keepalive idle timeout on the given socket, an error variant will be returned explaining the underlying I/O error.