Struct TcpKeepalive

struct TcpKeepalive { ... }

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: 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: 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.

impl Clone for TcpKeepalive

fn clone(self: &Self) -> TcpKeepalive

impl Debug for TcpKeepalive

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

impl Freeze for TcpKeepalive

impl RefUnwindSafe for TcpKeepalive

impl Send for TcpKeepalive

impl Sync for TcpKeepalive

impl Unpin for TcpKeepalive

impl UnwindSafe for TcpKeepalive

impl<T> Any for TcpKeepalive

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for TcpKeepalive

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for TcpKeepalive

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

impl<T> CloneToUninit for TcpKeepalive

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

impl<T> From for TcpKeepalive

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for TcpKeepalive

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T, U> Into for TcpKeepalive

fn into(self: 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 for TcpKeepalive

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for TcpKeepalive

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