pub struct TcpKeepalive {
pub time: Option<Duration>,
pub interval: Option<Duration>,
pub retries: Option<u32>,
}Expand description
When an idle connection’s keepalive probes start, how far apart they go, and how many
unanswered ones drop the connection. A field left None keeps the system’s value.
Times are whole seconds, as the system takes them: a part of one counts as one more.
use std::time::Duration;
use nuclei::net::{TcpKeepalive, TcpSocket};
let socket = TcpSocket::new_v4()?;
socket.set_keepalive_timing(TcpKeepalive {
time: Some(Duration::from_secs(60)),
interval: Some(Duration::from_secs(10)),
retries: Some(5),
})?;
assert!(socket.keepalive()?);Fields§
§time: Option<Duration>How long the connection is idle before the first probe.
interval: Option<Duration>How long after an unanswered probe the next one goes.
retries: Option<u32>How many unanswered probes drop the connection.
Trait Implementations§
Source§impl Clone for TcpKeepalive
impl Clone for TcpKeepalive
Source§fn clone(&self) -> TcpKeepalive
fn clone(&self) -> TcpKeepalive
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for TcpKeepalive
Source§impl Debug for TcpKeepalive
impl Debug for TcpKeepalive
Source§impl Default for TcpKeepalive
impl Default for TcpKeepalive
Source§fn default() -> TcpKeepalive
fn default() -> TcpKeepalive
Returns the “default value” for a type. Read more
impl Eq for TcpKeepalive
Source§impl PartialEq for TcpKeepalive
impl PartialEq for TcpKeepalive
impl StructuralPartialEq for TcpKeepalive
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§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more