Struct TcpKeepalive
pub struct TcpKeepalive { /* private fields */ }
Configures a socket's TCP keepalive parameters.
Implementations
impl TcpKeepalive
const fn new() -> TcpKeepaliveReturns a new, empty set of TCP keepalive parameters.
const fn with_time(self, time: Duration) -> SelfSet the amount of time after which TCP keepalive probes will be sent on idle connections.
This will set
TCP_KEEPALIVEon macOS and iOS, andTCP_KEEPIDLEon all other Unix operating systems, except OpenBSD and Haiku which don't support any way to set this option. On Windows, this sets the value of thetcp_keepalivestruct'skeepalivetimefield.Some platforms specify this value in seconds, so sub-second specifications may be omitted.
const fn with_interval(self, interval: Duration) -> SelfSet the value of the
TCP_KEEPINTVLoption. On Windows, this sets the value of thetcp_keepalivestruct'skeepaliveintervalfield.Sets the time interval between TCP keepalive probes.
Some platforms specify this value in seconds, so sub-second specifications may be omitted.
const fn with_retries(self, retries: u32) -> SelfSet the value of the
TCP_KEEPCNToption.Set the maximum number of TCP keepalive probes that will be sent before dropping a connection, if TCP keepalive is enabled on this socket.
Trait Implementations
impl Clone for TcpKeepalive
fn clone(&self) -> Self
impl Debug for TcpKeepalive
fn fmt(&self, f: &mut Formatter<'_>) -> Result