How do I get the Status of the interface network?

Viewed 77

How do I get the Network Status on MacOS?

I tried changing the second argument of SCNetworkInterfaceGetExtendedConfiguration(interface, kSCEntNetEthernet) in various ways, but all results were nil.

And I also tried SCNetworkInterfaceGetConfiguration(interface) and got the result below:

Optional({
    JoinModeFallback =     (
        DoNothing
    );
    PowerEnabled = 1;
    RememberJoinedNetworks = 1;
    Version = 3000;
})

but it has no status which I wanted.

I would like to programmatically get the status as Connected information in the following image, which can be found in System Preferences > Network.

enter image description here

0 Answers
Related