Is it possible to write a Ping class in C# that wi

2019-01-28 01:40发布

Since the Metro environment on Windows 8 lacks most of the .NET framework class libraries or contains a substancially pared down version, is it possible to execute a "ping" from a Metro style application? There is support for Sockets, so I guess there is hope, but I don't know where to start, since every "C# Ping" example uses System.Net.NetworkInformation.Ping and that is not available in WinRT.

I also looked into the source code for Mono, and their ping implementation fires up ping.exe and returns the result from the standard output window of the command line.

1条回答
爷、活的狠高调
2楼-- · 2019-01-28 01:54

No, unfortunately not. ICMP is not supported in WinRT: IcmpCreateFile and related Win32 APIs are only available in the "desktop" API partition. ICMP can be implemented using raw sockets but since these are not supported in WinRT (and usually require elevation, anyway), this option is also not available to you.

As the developer of a Windows Store network scanning tool myself (http://lanscan.rcook.org/), I'd love to be able to do this.

查看更多
登录 后发表回答