Java 到 VB.Net 的转换 [小片段]
我有这个片段,它是用 Java 编写的:
final InetAddress address = InetAddress.getLocalHost();
final NetworkInterface ni = NetworkInterface.getByInetAddress(address);
key = new String(ni.getHardwareAddress());
关键输出示例:▲╔UiÎ
VB.Net 中的等效项是什么?我知道第一行获取本地主机,其余的呢?提前致谢。
I have this snippet, it's in Java:
final InetAddress address = InetAddress.getLocalHost();
final NetworkInterface ni = NetworkInterface.getByInetAddress(address);
key = new String(ni.getHardwareAddress());
Example of key output: ▲╔UiÎ
What is the equivalent in VB.Net? I understand the first line gets Local Host, what about the rest? Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这会迭代所有本地接口:
物理地址就是您想要的。
该行
只是通过 inetaddress 获取特定的网络接口
假设您将本地主机地址存储在名为 localIa 的变量中,然后您可以使用它:
This iterates over all local interfaces:
The physical address is what you want.
The line
just grabs the specific network interface by the inetaddress
Say you store your localhost address in a variable called localIa and then you can use it: