Contents

Method

GetIpAddresses

ModuleNetwork
LibraryCore
Action


Gets IP addresses assigned to the machine.

Parameters(None)
Return values

IpAddress (string): The IP address of the adapter

IpVersion (string): IPv4/IPv6

MacAddress (string): Physical address. Not available on Android. This field is empty if there is no hardware MAC address assigned to the adapter, for example on a loopback address.

AdapterName (string): Friendly name of the adapter to which the IP address is assigned. Not available on Android.

AdapterType (string): Type of the adapter. For Windows, 'friendly' strings returned are based off IP_ADAPTER_INFO type defines. Not available on Android. If available, this will describe the adapter hardware type. If it is unknown, it will report "Unknown: x" where x is a number corresponding to the device type returned by the operating system. These enumerations can differ between operating systems, though they are typically based off defines in RFC1573. If just "Unknown" is returned, the operating system has returned the enumeration for "Other/Unknown".

SubnetMask (string): Subnet mask for the IP address. This is only supplied for IPv4 addresses. It is implicit in an IPv6 address. Not available on Android.

DefaultGateway (string): The IP address of the default network gateway. New in v5.3.

Description (string): Description of the network adapter. New in v5.3.

DhcpEnabled (bool): Indicates if DHCP is enabled. New in v5.3.

DhcpLeaseExpiry (string): DHCP lease expiry time. New in v5.3.

DhcpServer (string): The IP address of any configured DHCP server. New in v5.3.

PrimaryDnsServer (string): IP address of primary DNS Server. New in v5.3.

RouteMetric (string): The route metric used to compute the route preferences. Given a routing choice, the route with the lowest metric will be selected. New in v5.3.

SecondaryDnsServers (string): A comma-separated list of IP addresses of any secondary DNS servers. New in v5.3.

Example
Network.GetIpAddresses();
Platforms
  • Windows
  • Linux
  • MacOS
  • Solaris Intel
  • Solaris Sparc
  • Android
Notes

On Solaris (Intel, at least - SPARC requires testing), the mac address is part of the ifreq structure, but the pointer appears to be off by 2 bytes. Not sure why this is occurring, but we're currently adjusting, and it seems we're getting the correct mac address.

DefaultGateway, Description, DhcpEnabled, DhcpLeaseExpiry, DhcpServer, PrimaryDnsServer, RouteMetric and SecondaryDnsServers are new for v5.3 and are null on every platform but Windows.