VB.NET 抓IP 和 MacAddress
System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces() 可取得所有 NIC 的 NetworkInterfaceNetworkInterface.GetPhysicalAddress() 可取得 MAC
NetworkInterface.GetIPProperties() 可取得 IP
'NetworkInterface.GetPhysicalAddress() 回傳 PhysicalAddress 型態, 可以用
dim MacAdd as String= BitConver.ToString(NetworkInterface.GetPhysicalAddress().GetAddressBytes())
'NetworkInterface.GetIPProperties() 回傳 IPInterfaceProperties 型態, 可以用
dim prop as IPInterfaceProperties = NetworkInterface.GetIPProperties()
dim ip as string = prop.UnicastAddresses.Address.ToString()
頁:
[1]