Skip to main content

1E SDK

Network.GetIpAddresses

Method

GetIpAddresses

Module

Network

Library

Core

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. This 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.

AdapterType (string): Type of the adapter. For Windows, 'friendly' strings returned are based off IP_ADAPTER_INFO type defines. 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.

DefaultGateway (string): The IP address of the default network gateway.

Description (string): Description of the network adapter.

DhcpEnabled (bool): Indicates if DHCP is enabled.

DhcpLeaseExpiry (string): DHCP lease expiry time.

DhcpServer (string): The IP address of any configured DHCP server.

PrimaryDnsServer (string): IP address of primary DNS Server.

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

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

HardwareInterface (bool): The Adapter is an actual physical hardware interface or not.

Example

Network.GetIpAddresses();

Platforms

  • Windows

  • Linux

  • MacOS

Notes

DefaultGateway, DhcpEnabled, DhcpLeaseExpiry, DhcpServer, PrimaryDnsServer and SecondaryDnsServers are null on every platform but Windows and MacOS.

Description, RouteMetric, HardwareInterface are only available on Windows.