beetlebug▾
/

ztcl::device network

Gives the state of the network.

ztcl::device network

Description

Gives a dict: connected (1 or 0), type (wifi, cellular, ethernet, or none), metered (1 for a network that costs), and constrained (1 in the Low Data Mode of iOS or the Data Saver of Android).

Returns

A dict with the keys connected, type, metered, and constrained.

Examples

# A host with no network service, as a desktop.
% catch {ztcl::device network} msg; set msg
the network state is not available on this platform

Errors

% ztcl::device network
the network state is not available on this platform
-errorcode ZTCL DEVICE UNAVAILABLE

% ztcl::device network x
wrong # args: should be "ztcl::device network"
-errorcode TCL WRONGARGS

Facts

Capability
device. A new interpreter does not have it until the host turns it on.
Tcl release
Tcl 9.1 and 8.6.
Since
ztcl 1.0.0-beta.6

See also