connectionBandwidth

fnConnectionBandwidth[] connectionBandwidth(Duration window = Duration.zero) @system

Gets bandwidth information for all active network connections.

This function samples network connections over the specified window to calculate bandwidth metrics for each connection. It maintains internal state between calls to track connection history.

Parameters

windowThe sampling duration. Use Duration.zero for immediate snapshot, or specify a duration to wait and measure.

Returns

Array of ConnectionBandwidth structs containing bandwidth information.

Example:

// Get immediate bandwidth estimate
auto bw1 = connectionBandwidth();

// Sample over 2 seconds for more accurate measurement
auto bw2 = connectionBandwidth(2.seconds);