是否可以在Windows Phone 7上执行ping操作? [英] Is it possible to implement ping on windows phone 7?

查看:82
本文介绍了是否可以在Windows Phone 7上执行ping操作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要获得WP7中网络功能的印象,我将构建一个简单的ping应用程序,该应用程序将向特定主机显示ICMP ping请求的结果.

To get the impression of networking capabilities in WP7 I was going to build a simple ping app that would display the result of ICMP ping request to a certain host.

但是,不仅缺少System.Net.NetworkInformation.Ping类,而且还缺少System.Net.Sockets名称空间.

However, not only the System.Net.NetworkInformation.Ping class is missing, System.Net.Sockets namespace is missing as well.

经过简短的研究,我发现WP7中只有两种通信方式:WebClient类可用于http(s)请求,而WCF客户端可用于SOA服务.

After a short research I found out that there are only two ways of communication in WP7: WebClient class that works with http(s) requests and WCF-client that works with SOA services.

这是否意味着我无法直接通过电话ping主机?我看到的唯一可能的解决方案是在专用服务器上实现单独的WCF服务,该服务将对电话执行ping操作,这看起来像是一种过大的功能,并且存在某些缺陷.

Does that mean that I can't ping hosts directly from the phone? The only possible solution I see is implementing a separate WCF service on a dedicated server that will do the pinging for the phone, which looks like an overkill and has certain flaws.

推荐答案

在套接字到达WP7平台之前,您将无法执行此操作,因为将没有其他方法可以发送ICMP数据包.

You won't be able to do this until sockets come to the WP7 platform as there isn't going to be any other way to send an ICMP packet.

电话也可能无法响应来自服务器的ping操作-我们必须对此进行查看.如果他们不这样做,我会怀疑是否会在未受黑客攻击的设备上对此进行更改.

The phones may not respond to pings back from a server either - we'll have to see on that. If they don't I doubt there would be anyway to change this on unhacked devices.

从服务器代表手机向目标主机执行ping操作不会太有帮助,因为不幸的是,它不会以任何方式反映手机与目标主机之间的延迟.

Pinging to a target host from a server on behalf of a phone isn't going to be too helpful either since unfortunately it won't reflect the latency between phone and target host in any way.

这篇关于是否可以在Windows Phone 7上执行ping操作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆