Private Sub GetAddress As String
Dim niIterator As JavaObject
niIterator = niIterator.InitializeStatic("java.net.NetworkInterface").RunMethod("getNetworkInterfaces", Null)
Do While niIterator.RunMethod("hasMoreElements", Null)
Dim ni As JavaObject = niIterator.RunMethod("nextElement", Null)
Dim Name As String = ni.RunMethod("getName", Null)
Log("GetAddress - Name:" &Name)
If Name.EqualsIgnoreCase("p2p0") = False Then
Continue
End If
Dim MacBytes() As Byte = ni.RunMethod("getHardwareAddress", Null)
If MacBytes.Length = 0 Then
Continue
End If
Dim BC As ByteConverter
Dim MacAddr As String
For Each B As Byte In MacBytes
MacAddr = MacAddr &BC.HexFromBytes(Array As Byte(B)) &":"
Next
If MacAddr.Length > 0 Then
MacAddr = MacAddr.SubString2(0, MacAddr.Length-1)
Log($"MacAddr[${MacAddr}]"$)
If MacAddr.Length > 0 Then
Return MacAddr
End If
End If
Loop
Return ""
End Sub