From Xojo Documentation

Revision as of 06:56, 30 January 2022 by Gperlman (talk | contribs) (Examples)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!


Used to obtain information about the computer’s network interface.

IPAddress fa-lock-32.png Name fa-lock-32.png
MacAddress fa-lock-32.png SubnetMask fa-lock-32.png

Shared Properties
Loopback fa-lock-32.png


Use the GetNetworkInterface method of the System module to instantiate the NetworkInterface object. See the example.

Multiple network interfaces are supported for Windows, macOS, and Linux. This allows you to write applications that can bind to different network interface cards on a user's machine. You can use this to write tunneling applications, for example.

To see what interfaces are installed on the user’s machine, use the GetNetworkInterface method of the System module and assign the obtained interface object to the NetworkInterface property of the SocketCore class. When you do so, the socket will bind to that network interface.


The following simple example displays the IP address, Subnet mask, and Mac address for the selected network interface. At start-up, the application detects all the network interfaces installed on the user's computer and loads them into a PopupMenu. The user then selects the desired network interface and the values are displayed in TextFields.

The PopupMenu's Opening event handler is:

For i As Integer = 0 To System.NetworkInterfaceCount - 1

The SelectionChanged event handler for the PopupMenu is this:

Var n As NetworkInterface

// Get the NetworkInterface object for the selected item
n = System.NetworkInterface(Me.SelectedRowIndex)

// Get the MAC Address
MacAddressField.Text = n.MACAddress
// Get the IP Address
IPAddressField.Text = n.IPAddress
// Get the Subnet Mask
SubnetMaskField.Text = n.SubnetMask

See Also

System module; SocketCore, TCPSocket classes.