NetworkInterface.LoopbackInterfaceIndex Property


Gets the index of the IPv4 loopback interface.

Namespace:   System.Net.NetworkInformation
Assembly:  System (in System.dll)

public static int LoopbackInterfaceIndex { get; }

Property Value

Type: System.Int32

A Int32 that contains the index for the IPv4 loopback interface.

Exception Condition

This property is not valid on computers running only Ipv6.

The index of the loopback interface is usually 1, but you cannot rely on this. Use the LoopbackInterfaceIndex property to get the correct value.

A network interface may have different interface indexes for the IPv4 and IPv6 loopback interface. The LoopbackInterfaceIndex property only returns the IPv4 loopback interface.

.NET Framework
Available since 2.0
Return to top