Skip to main content

connections

Function connections 

Source
pub fn connections() -> Result<Connections>
Expand description

How many network connections the machine has open: counts only, never addresses, ports, or owners. Inside a container they are the container’s network namespace.

if let Some(open) = sys_lib::net::connections()?.tcp_established {
    println!("{open} TCP connections open");
}

§Errors

NotFound when the counters are hidden; Malformed; Os.