Condividi tramite


NetworkInterface.NetworkInterfaces Property

Definition

Returns all the interfaces on this machine.

public static Java.Util.IEnumeration? NetworkInterfaces { [Android.Runtime.Register("getNetworkInterfaces", "()Ljava/util/Enumeration;", "")] get; }
[<get: Android.Runtime.Register("getNetworkInterfaces", "()Ljava/util/Enumeration;", "")>]
static member NetworkInterfaces : Java.Util.IEnumeration

Property Value

an Enumeration of NetworkInterfaces found on this machine that are accessible.

Attributes

Exceptions

if an error occurs while getting the network interface information.

Remarks

Returns all the interfaces on this machine. The Enumeration contains at least one element, possibly representing a loopback interface that only supports communication between entities on this machine.

NOTE: can use getNetworkInterfaces()+getInetAddresses() to obtain all IP addresses for this node

For non-system apps, this method will only return information for NetworkInterfaces associated with an InetAddress.

ANDROID NOTE: On Android versions before S (API level 31), this method may throw a NullPointerException if called in an environment where there is a virtual interface without a parent interface present.

Java documentation for java.net.NetworkInterface.getNetworkInterfaces().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to