Is it possible to write a Ping class in C# that will run within Windows 8 Metro environment?(是否可以用 C# 编写一个将在 Windows 8 Metro 环境中运行的 Ping 类?)
问题描述
由于 Windows 8 上的 Metro 环境缺少大部分 .NET 框架类库或包含大幅缩减的版本,是否可以从 Metro 风格应用程序执行ping"?支持 Sockets,所以我想有希望,但我不知道从哪里开始,因为每个C# Ping"示例都使用 System.Net.NetworkInformation.Ping
,这在 WinRT 中不可用.
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.
我还查看了 Mono 的源代码,他们的 ping 实现会启动 ping.exe 并从命令行的标准输出窗口返回结果.
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.
推荐答案
不,很遗憾没有.WinRT 不支持 ICMP:IcmpCreateFile
和相关的 Win32 API 仅在桌面"API 分区中可用.ICMP 可以使用原始套接字实现,但由于 WinRT 不支持这些(并且通常需要提升,无论如何),您也无法使用此选项.
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.
我自己作为 Windows 应用商店网络扫描工具的开发者(http://lanscan.rcook.org/),我很想能够做到这一点.
As the developer of a Windows Store network scanning tool myself (http://lanscan.rcook.org/), I'd love to be able to do this.
这篇关于是否可以用 C# 编写一个将在 Windows 8 Metro 环境中运行的 Ping 类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:是否可以用 C# 编写一个将在 Windows 8 Metro 环境中运行的 Ping 类?
基础教程推荐
- SSE 浮点算术是否可重现? 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- rabbitmq 的 REST API 2022-01-01
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- 如何激活MC67中的红灯 2022-01-01
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- 将 XML 转换为通用列表 2022-01-01
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01
- c# Math.Sqrt 实现 2022-01-01
- MS Visual Studio .NET 的替代品 2022-01-01