Trait TcpStreamExt

1.89.0 · Source
pub trait TcpStreamExt: Sealed {
    // Required methods
    fn set_quickack(&self, quickack: bool) -> Result<()>;
    fn quickack(&self) -> Result<bool>;
}
Available on Linux and (Linux or Android) only.
Expand description

Os-specific extensions for TcpStream

Required Methods§

1.89.0 · Source

fn set_quickack(&self, quickack: bool) -> Result<()>

Enable or disable TCP_QUICKACK.

This flag causes Linux to eagerly send ACKs rather than delaying them. Linux may reset this flag after further operations on the socket.

See man 7 tcp and TCP delayed acknowledgement for more information.

§Examples
use std::net::TcpStream;
#[cfg(target_os = "linux")]
use std::os::linux::net::TcpStreamExt;
#[cfg(target_os = "android")]
use std::os::android::net::TcpStreamExt;

let stream = TcpStream::connect("127.0.0.1:8080")
        .expect("Couldn't connect to the server...");
stream.set_quickack(true).expect("set_quickack call failed");
1.89.0 · Source

fn quickack(&self) -> Result<bool>

Gets the value of the TCP_QUICKACK option on this socket.

For more information about this option, see TcpStreamExt::set_quickack.

§Examples
use std::net::TcpStream;
#[cfg(target_os = "linux")]
use std::os::linux::net::TcpStreamExt;
#[cfg(target_os = "android")]
use std::os::android::net::TcpStreamExt;

let stream = TcpStream::connect("127.0.0.1:8080")
        .expect("Couldn't connect to the server...");
stream.set_quickack(true).expect("set_quickack call failed");
assert_eq!(stream.quickack().unwrap_or(false), true);

Implementors§

1.89.0 · Source§

impl TcpStreamExt for TcpStream