Name
GetLocalInterfaces -- get local interfaces (V9.0)
Synopsis
t = GetLocalInterfaces([linklocal])
Function
This function returns a list of all network interfaces that are currently available. This allows you to conveniently determine a system's local IP address. If the optional linklocal argument is set to True, link-local addresses will be included as well.

GetLocalInterfaces() will return a table that contains a number of subtables, each describing a local interface. The following fields will be initialized in each subtable:

Name:
The name of the interface.

Address:
The address of the interface. Depending on the setting of the Protocol tag (see below), this may be either an IPv4 or IPv6 address.

Protocol:
The protocol of the interface. This will be one of the following predefined constants:

#IPV4:
Internet Protocol version 4 (IPv4). IPv4 addresses are limited to 32 bits and are represented using four numbers separated by three dots, e.g. 127.0.0.1.

#IPV6:
Internet Protocol version 6 (IPv6). IPv6 addresses use 128 bits and are represented by eight groups of four hexadecimal digits, e.g. 2001:0db8:85a3:0000:0000:8a2e:0370:7334. Note that #IPV6 is currently unsupported on AmigaOS and compatible systems.

Inputs
linklocal
optional: True to include link-local addresses in the return table, False to exclude them (defaults to False)
Results
t
table containing a list of all local interfaces
Example
t = GetLocalInterfaces()
For Local k = 0 To ListItems(t) - 1
   NPrint(t[k].Name, t[k].Address, t[k].Protocol)
Next
The code above prints information about all available network interfaces.

Show TOC