5

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.

Nate
  • 30,286
  • 23
  • 113
  • 184

1 Answers1

5

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.

Richard Cook
  • 32,523
  • 5
  • 46
  • 71
  • 2
    I really wish I could do this too. I run http://www.wp-networktools.com/ and I continually get bad reviews because the app wont ping local addresses. I was trying to port it to WinRT but without this API I will get such poor reviews it isn't really worth it. Shame really, because it would be really cool. – Nate Feb 24 '13 at 23:46
  • Yep. That's exactly the feedback I've received from a few people with regard to Lanscan! – Richard Cook Feb 24 '13 at 23:50
  • Microsoft decided that the usage is not allowed/necessary in UWP and sticks to it to this day. 2021 and still no ICMP Ping in UWP/UAP/WinRT. Seriously, every platform despite UAP can ping, even the "golden cage" iOS allows ping. Here's a comment by the former MS product manager: https://learn.microsoft.com/en-us/answers/questions/23244/whyping-functionality-is-not-supported-in-uwp-plat.html – juwens Feb 27 '21 at 22:11