Trait std::os::linux::net::TcpStreamExt

source ·
pub trait TcpStreamExt: Sealed {
    // Required methods
    fn set_quickack(&self, quickack: bool) -> Result<()>;
    fn quickack(&self) -> Result<bool>;
}
🔬This is a nightly-only experimental API. (tcp_quickack #96256)
Available on Linux and (Linux or Android) only.
Expand description

TcpStream 的特定于操作系统的扩展

Required Methods§

source

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

🔬This is a nightly-only experimental API. (tcp_quickack #96256)

启用或禁用 TCP_QUICKACK

该标志使 Linux 急切地发送 ACK 而不是延迟它们。 Linux 可能会在对套接字进行进一步操作后重置此标志。

See man 7 tcpTCP delayed acknowledgement 了解更多信息。

Examples
#![feature(tcp_quickack)]
use std::net::TcpStream;
use std::os::linux::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");
Run
source

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

🔬This is a nightly-only experimental API. (tcp_quickack #96256)

获取此套接字上 TCP_QUICKACK 选项的值。

有关此选项的详细信息,请参见 TcpStreamExt::set_quickack

Examples
#![feature(tcp_quickack)]
use std::net::TcpStream;
use std::os::linux::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);
Run

Implementors§