如何在 C# 中使用 ResolveIpNetEntry2
我正在尝试在 C# 中检索 IPv6 主机的 MAC 地址。我发现这个 问题 提到使用 ResolveIpNetEntry2。经过一番谷歌搜索并参考 MSDN,我还没有找到如何从 C# 调用此函数的示例。此功能在 pinvoke.net 上也未列出。
有人有如何从 C# 调用 ResolveIpNetEntry2 的示例吗?
I am attempting to retrieve the MAC address of an IPv6 host in C#. I found this question which mentions using ResolveIpNetEntry2. After some googling, and referencing the MSDN, I haven't found an example of how to call this function from C#. This function is also unlisted on pinvoke.net.
Does anyone have an example of how to call ResolveIpNetEntry2 from C#?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
下面是一个类,显示所需的结构以及如何调用 ResolveIpNetEntry2:
基本上,只需 ping 目标主机,并将返回的地址提供给该函数。
clsNetworkStats 类用于确定应使用的 InterfaceIndex。我在这里找到了这个代码示例 并稍加修改。
Here is a class showing the structures needed and how to make the call to ResolveIpNetEntry2:
Basically, just ping the target host, and feed the address returned to this function.
The class clsNetworkStats is used to determine the InterfaceIndex that should be used. I found this code example here and modified it slightly.