pub struct TcpConfig {Show 19 fields
pub socket_family: SocketFamily,
pub socket_type: TcpSocketType,
pub bind_addr: Option<SocketAddr>,
pub nonblocking: bool,
pub reuseaddr: Option<bool>,
pub reuseport: Option<bool>,
pub nodelay: Option<bool>,
pub linger: Option<Duration>,
pub ttl: Option<u32>,
pub hoplimit: Option<u32>,
pub read_timeout: Option<Duration>,
pub write_timeout: Option<Duration>,
pub recv_buffer_size: Option<usize>,
pub send_buffer_size: Option<usize>,
pub tos: Option<u32>,
pub tclass_v6: Option<u32>,
pub only_v6: Option<bool>,
pub bind_device: Option<String>,
pub keepalive: Option<bool>,
}Expand description
Configuration options for a TCP socket.
Fields§
§socket_family: SocketFamilyThe socket family, either IPv4 or IPv6.
socket_type: TcpSocketTypeThe type of TCP socket, either STREAM or RAW.
bind_addr: Option<SocketAddr>Optional address to bind the socket to.
nonblocking: boolWhether the socket should be non-blocking.
reuseaddr: Option<bool>Whether to allow address reuse.
reuseport: Option<bool>Whether to allow port reuse (SO_REUSEPORT) where supported.
nodelay: Option<bool>Whether to disable Nagle’s algorithm (TCP_NODELAY).
linger: Option<Duration>Optional linger duration for the socket.
ttl: Option<u32>Optional Time-To-Live (TTL) for the socket.
hoplimit: Option<u32>Optional Hop Limit for the socket (IPv6).
read_timeout: Option<Duration>Optional read timeout for the socket.
write_timeout: Option<Duration>Optional write timeout for the socket.
recv_buffer_size: Option<usize>Optional receive buffer size in bytes.
send_buffer_size: Option<usize>Optional send buffer size in bytes.
tos: Option<u32>Optional IPv4 TOS / DSCP field value.
tclass_v6: Option<u32>Optional IPv6 traffic class value (IPV6_TCLASS) where supported.
only_v6: Option<bool>Whether to force IPv6-only behavior on dual-stack sockets.
bind_device: Option<String>Optional device to bind the socket to.
keepalive: Option<bool>Whether to enable TCP keepalive.
Implementations§
Source§impl TcpConfig
impl TcpConfig
Sourcepub fn new(socket_family: SocketFamily) -> Self
pub fn new(socket_family: SocketFamily) -> Self
Create a STREAM socket for the specified family.