ICMP in Windows 10 Universal Apps

荒凉一梦 提交于 2020-01-16 04:24:12

问题


I would like to be able to do some ICMP network diagnostics from a windows 10 universal app, including ping, traceroute, etc.

However it would appear that the System.Net.NetworkInformation.Ping class isn't available to store apps and when creating a new System.Net.Sockets.Socket the ProtocolType.Icmp is not available when I try.

All the information I can find on the Internet about this topic all relates to windows 8.1 apps and I want to know if anything new has been added to the API in Windows 10 that would allow me to produce ICMP ping, etc.

I've seen suggestions that you could use raw sockets but it appears that these are no longer allowed on client versions of Windows.

My preferred language is C# but I'm OK with using C++ if this gives me an advantage.

Note: checking the network status is not sufficient. I'm actually wanting to test the connection to specific machines on the network, I really do want a proper ICMP ping.


回答1:


The System.Net.NetworkInformation.Ping dot net class is a wrapper for the Win32 IP Helper Functions.

UWP Apps run in a protected environment, and as a result, many Win32, COM, and CRT API calls that might compromise the security of the platform are not allowed.

Windows Runtime apps and Universal Windows Platform (UWP) apps can use a subset of the Win32 and COM APIs which you can call in a native app.

Unfortunately, the Win32 IP Helper Functions are not supported in UWP yet.



来源:https://stackoverflow.com/questions/32040753/icmp-in-windows-10-universal-apps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!