Sub Process_Globals
Type NetworkInterface (Name As String, DisplayName As String, Address As String)
End Sub
Sub AppStart (Args() As String)
Log("Hello world!!!")
Log(GetNetworkInterfacesWithIp4Address)
End Sub
Private Sub GetNetworkInterfacesWithIp4Address As List
Dim NetworkInterface As JavaObject
NetworkInterface.InitializeStatic("java.net.NetworkInterface")
Dim Collections As JavaObject
Collections.InitializeStatic("java.util.Collections")
Dim res As List
res.Initialize
Dim interfaces As List = Collections.RunMethod("list", Array(NetworkInterface.RunMethod("getNetworkInterfaces", Null)))
For Each interface As JavaObject In interfaces
Dim ni As NetworkInterface
ni.Initialize
ni.Name = interface.RunMethod("getName", Null)
ni.DisplayName = interface.RunMethod("getDisplayName", Null)
Dim Addresses As List = Collections.RunMethod("list", Array(interface.RunMethod("getInetAddresses", Null)))
For Each add As JavaObject In Addresses
If GetType(add) = "java.net.Inet4Address" Then
ni.Address = add.RunMethod("getHostAddress", Null)
End If
Next
If ni.Address <> "" Then res.Add(ni)
Next
Return res
End Sub