Struct TcpKeepalive

pub struct TcpKeepalive { /* private fields */ }

Configures a socket's TCP keepalive parameters.

See Socket::set_tcp_keepalive.

Implementations

impl TcpKeepalive

const fn new() -> TcpKeepalive

Returns a new, empty set of TCP keepalive parameters.

const fn with_time(self, time: Duration) -> Self

Set the amount of time after which TCP keepalive probes will be sent on idle connections.

This will set TCP_KEEPALIVE on macOS and iOS, and TCP_KEEPIDLE on 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 the tcp_keepalive struct's keepalivetime field.

Some platforms specify this value in seconds, so sub-second specifications may be omitted.

const fn with_interval(self, interval: Duration) -> Self

Set the value of the TCP_KEEPINTVL option. On Windows, this sets the value of the tcp_keepalive struct's keepaliveinterval field.

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) -> Self

Set the value of the TCP_KEEPCNT option.

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) -> TcpKeepalive

impl Debug for TcpKeepalive

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Auto Trait Implementations

impl Freeze for TcpKeepalive

impl RefUnwindSafe for TcpKeepalive

impl Send for TcpKeepalive

impl Sync for TcpKeepalive

impl Unpin for TcpKeepalive

impl UnsafeUnpin for TcpKeepalive

impl UnwindSafe for TcpKeepalive

Blanket Implementations

impl<T> Any for TcpKeepalive where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for TcpKeepalive where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for TcpKeepalive where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> CloneToUninit for TcpKeepalive where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for TcpKeepalive

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for TcpKeepalive where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T, U> Into<U> for TcpKeepalive where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for TcpKeepalive where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for TcpKeepalive where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>