Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to write a Ping class in C# that will run within Windows 8 Metro environment?

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.

like image 893
Nate Avatar asked Jun 08 '12 16:06

Nate


People also ask

What does C mean in ping?

-c. Specifies the number of packets. This option is useful when you get an IP trace log. You can capture a minimum of ping packets.

What type of command is ping?

ping is the primary TCP/IP command used to troubleshoot connectivity, reachability, and name resolution. Used without parameters, this command displays Help content. You can also use this command to test both the computer name and the IP address of the computer.


1 Answers

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.

like image 170
Richard Cook Avatar answered Sep 29 '22 08:09

Richard Cook