- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用适用于 MAC 但不适用于 iOS 的苹果简单 ping 源代码。 https://developer.apple.com/library/mac/samplecode/SimplePing/Introduction/Intro.html下面是我正在写的代码
ping = [SimplePing simplePingWithHostName:@"www.google.com"];
ping.delegate = self;
[ping start];
控制台响应
2016-03-18 18:11:07.252 PinPin[383:49747] >CFHostStartInfoResolution
2016-03-18 18:11:07.256 PinPin[383:49747] <CFHostStartInfoResolution
2016-03-18 18:11:07.334 PinPin[383:49747] >HostResolveCallback
2016-03-18 18:11:07.336 PinPin[383:49747] didStartWithAddress
16-03-18 18:22:42.375 PinPin[383:49747] didReceiveUnexpectedPacket
2016-03-18 18:22:44.382 PinPin[383:49747] didReceiveUnexpectedPacket
2016-03-18 18:22:46.388 PinPin[383:49747] didReceiveUnexpectedPacket
2016-03-18 18:22:48.419 PinPin[383:49747] didReceiveUnexpectedPacket
2016-03-18 18:22:50.422 PinPin[383:49747] didReceiveUnexpectedPacket
2016-03-18 18:22:52.820 PinPin[383:49747] didReceiveUnexpectedPacket
2016-03-18 18:22:54.852 PinPin[383:49747] didReceiveUnexpectedPacket
2016-03-18 18:22:56.857 PinPin[383:49747] didReceiveUnexpectedPacket
2016-03-18 18:22:58.862 PinPin[383:49747] didReceiveUnexpectedPacket
2016-03-18 18:23:00.844 PinPin[383:49747] didReceiveUnexpectedPacket
2016-03-18 18:23:02.855 PinPin[383:49747] didReceiveUnexpectedPacket
2016-03-18 18:23:05.178 PinPin[383:49747] didReceiveUnexpectedPacket
2016-03-18 18:23:07.006 PinPin[383:49747] didReceiveUnexpectedPacket
此后没有任何事情发生,没有其他代表这样调用
- (void)simplePing:(SimplePing *)pinger didFailWithError:(NSError *)error;
- (void)simplePing:(SimplePing *)pinger didSendPacket:(NSData *)packet;
- (void)simplePing:(SimplePing *)pinger didFailToSendPacket:(NSData *)packet error:(NSError *)error;
- (void)simplePing:(SimplePing *)pinger didReceivePingResponsePacket:(NSData *)packet;
在 readMe.txt 中苹果说
“SimplePing 在 Mac OS X 10.7 及更高版本上运行,尽管核心代码在所有版本的 iOS 上运行良好并且底层方法在早期版本的 Mac OS X 上运行(回到 10.2) ”
//更新
麦克。回应
Anands-MacBook-Air:~ anand$ cd ~/Downloads/SimplePing
Anands-MacBook-Air:SimplePing anand$ build/Debug/SimplePing www.apple.com
2016-03-19 19:55:48.042 SimplePing[1149:19595] >CFHostStartInfoResolution
2016-03-19 19:55:48.045 SimplePing[1149:19595] <CFHostStartInfoResolution
2016-03-19 19:55:49.490 SimplePing[1149:19595] >HostResolveCallback
2016-03-19 19:55:49.491 SimplePing[1149:19595] pinging 23.211.220.146
2016-03-19 19:55:49.491 SimplePing[1149:19595] #0 sent
2016-03-19 19:55:49.551 SimplePing[1149:19595] #0 received
2016-03-19 19:55:50.493 SimplePing[1149:19595] #1 sent
2016-03-19 19:55:50.557 SimplePing[1149:19595] #1 received
2016-03-19 19:55:51.495 SimplePing[1149:19595] #2 sent
2016-03-19 19:55:51.553 SimplePing[1149:19595] #2 received
2016-03-19 19:55:52.493 SimplePing[1149:19595] #3 sent
2016-03-19 19:55:52.551 SimplePing[1149:19595] #3 received
2016-03-19 19:55:53.493 SimplePing[1149:19595] #4 sent
2016-03-19 19:55:53.551 SimplePing[1149:19595] #4 received
2016-03-19 19:55:54.497 SimplePing[1149:19595] #5 sent
2016-03-19 19:55:54.556 SimplePing[1149:19595] #5 received
2016-03-19 19:55:55.494 SimplePing[1149:19595] #6 sent
2016-03-19 19:55:55.550 SimplePing[1149:19595] #6 received
2016-03-19 19:55:56.492 SimplePing[1149:19595] #7 sent
2016-03-19 19:55:56.551 SimplePing[1149:19595] #7 received
2016-03-19 19:55:57.498 SimplePing[1149:19595] #8 sent
2016-03-19 19:55:57.562 SimplePing[1149:19595] #8 received
2016-03-19 19:55:58.494 SimplePing[1149:19595] #9 sent
2016-03-19 19:55:58.552 SimplePing[1149:19595] #9 received
最佳答案
尝试将此添加到您的 didStartWithAddress
:
- (void)simplePing:(SimplePing *)pinger didStartWithAddress:(NSData *)address
{
[pinger sendPingWithData:nil];
}
关于ios - 为什么 Apple 简单 ping 在 iOS 上不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36084912/
今天有小伙伴给我留言问到,try{...}catch(){...}是什么意思?它用来干什么? 简单的说 他们是用来捕获异常的 下面我们通过一个例子来详细讲解下
我正在努力提高网站的可访问性,但我不知道如何在页脚中标记社交媒体链接列表。这些链接指向我在 facecook、twitter 等上的帐户。我不想用 role="navigation" 标记这些链接,因
说现在是 6 点,我有一个 Timer 并在 10 点安排了一个 TimerTask。之后,System DateTime 被其他服务(例如 ntp)调整为 9 点钟。我仍然希望我的 TimerTas
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用资料或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
我就废话不多说了,大家还是直接看代码吧~ ? 1
Maven系列1 1.什么是Maven? Maven是一个项目管理工具,它包含了一个对象模型。一组标准集合,一个依赖管理系统。和用来运行定义在生命周期阶段中插件目标和逻辑。 核心功能 Mav
我是一名优秀的程序员,十分优秀!