I'm using Apple's SimplePing to ping a host on iPhone. I expect the following delegate methods to work.
(1) - (void)simplePing:(SimplePing *)pinger didSendPacket:(NSData *)packet;
(2) - (void)simplePing:(SimplePing *)pinger didReceivePingResponsePacket:(NSData *)packet;
(3) - (void)simplePing:(SimplePing *)pinger didReceiveUnexpectedPacket:(NSData *)packet;
(4) - (void)simplePing:(SimplePing *)pinger didFailToSendPacket:(NSData *)packet error:(NSError *)error;
The results are...
I tried some apps ( Network Ping Lite , Free Ping , Ping Free ) available in AppStore. Their result is similar to mine.
I wan't to know if this is a bug in the SimplePing sample code by Apple or are there some other configurations I need to do?
Below is the code i've used
- (void)viewDidLoad {
[super viewDidLoad];
self.simplePing = [SimplePing simplePingWithHostName:@"www.google.com"];
[self.simplePing setDelegate:self];
[self.simplePing start];
}
- (void)simplePing:(SimplePing *)pinger didStartWithAddress:(NSData *)address {
[self.simplePing sendPingWithData:nil];
}
simply:
you can't validate that a specific carrier supports or not supports a ping over the mobile network.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.