简体   繁体   English

从Objective-C iOS7 ping

[英]Ping from Objective-C iOS7

I understand there are multiple solutions already available to do a ping from an iOS application. 我了解已经有多种解决方案可用于从iOS应用程序执行ping操作。 However, most seem to be outdated, unsupported, or removed by Apple. 但是,大多数似乎已被Apple过时,不受支持或删除。

I also do not want to use SimplePing library (since it just appears to be bloated and the SimplePingHelper that is available uses selectors which doesn't fit into my application) or the Reachibility.m provided Apple (since it only checks if the path to the service is available, not if the service is actually online). 我也不想使用SimplePing库(因为它看起来似乎很肿,并且可用的SimplePingHelper使用了不适合我的应用程序的选择器)或Reachibility.m提供了Apple(因为它仅检查到以下路径的路径)该服务可用,如果该服务实际上是在线的则不可用)。 I also found another solution that is now deprecated. 我还发现了另一个不推荐使用的解决方案。

So, does anybody else have any other ideas on how to ping a server? 那么,还有其他人对如何ping服务器有其他想法吗?

Have you had a look at GBPing ? 您看过GBPing吗?

To quote the doc: 引用文档:

This code is a low level ping library that gives extremely accurate round-trip timing results without being impacted by UI and other processing on the main thread. 该代码是一个低级ping库,可提供极其精确的往返计时结果,而不受UI和主线程上其他处理的影响。 This is not the case with most other ping libraries such as the typical Apple SimplePing which are built as a single threaded class interleaved within the main thread of execution, causing them to suffer from all kinds of indeterministic errors. 大多数其他ping库(例如典型的Apple SimplePing)不是这种情况,它们是作为插入执行主线程中的单线程类构建的,从而导致它们遭受各种不确定性错误。 This library is a multi-threaded class built on top of BSD sockets and GCD, delivering the best possible timing accuracy regardless of system resource state or device performance. 该库是建立在BSD套接字和GCD之上的多线程类,无论系统资源状态或设备性能如何,都可提供最佳的计时精度。

There is a ping example in the open-source boost library. 开源Boost库中有一个ping示例 I've managed to compile and run it under OS X. I'm not sure if it would work under iOS. 我已经设法在OS X上编译并运行它。我不确定它是否可以在iOS下运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM