Easy-to-use ICMP Ping for iOS (and maybe OSX)

Related tags

Networking CDZPinger
Overview

CDZPinger

Easy-to-use ICMP ping for iOS - just create a CDZPinger and you delegate gets a callback every second with the average ping time.

Installation

Add the dependency to your Podfile:

platform :ios
pod 'CDZPinger'
...

Run pod install to install the dependencies.

Usage

#import "CDZPinger.h" and:

CDZPinger *pinger = [[CDZPinger alloc] initWithHost:@"google.com"];
// keep a strong reference to pinger, maybe in a property somewhere

pinger.delegate = self;
// (assuming self is your CDZPingerDelegate)

In your delegate:

#pragma mark CDZPingerDelegate

- (void)pinger:(CDZPinger *)pinger didUpdateWithAverageSeconds:(NSTimeInterval)seconds
{
    NSLog([NSString stringWithFormat:@"Received ping; average time %.f ms", seconds*1000]);
}

Requirements

CDZPinger requires iOS 5.x+. It might work on iOS 4, but I haven't tested it.

There's also some chance it'll work on OS X, but again, I haven't tested it there either.

License

MIT License. See LICENSE for the full details.

Developer

Chris Dzombak, with ICMP ping code from Apple sample code.

You might also like...
MultiPeer-Progress-iOS - Swift project to demo the use of the MultiPeer framework to send files between iOS devices and show the progress
WebSocket implementation for use by Client and Server

WebSocket ⚠️ This module contains no networking. To create a WebSocket Server, see WebSocketServer. To create a WebSocket Client, see WebSocketClient.

Another network wrapper for URLSession. Built to be simple, small and easy to create tests at the network layer of your application.
Another network wrapper for URLSession. Built to be simple, small and easy to create tests at the network layer of your application.

Another network wrapper for URLSession. Built to be simple, small and easy to create tests at the network layer of your application. Install Carthage

Easy and lightweight network layer for creating different set of network requests like GET, POST, PUT, DELETE customizable with coders conforming to TopLevelDecoder, TopLevelEncoder
Easy and lightweight network layer for creating different set of network requests like GET, POST, PUT, DELETE customizable with coders conforming to TopLevelDecoder, TopLevelEncoder

Easy and lightweight network layer for creating different set of network requests like GET, POST, PUT, DELETE customizable with coders conforming to TopLevelDecoder, TopLevelEncoder

Deal with query items, HTTP headers, request body and more in an easy, declarative way

Reusable system for complex URL requests with Swift. Deal with query items, HTTP headers, request body and more in an easy, declarative way. Check out our engineering blog to learn more!

a NSURLCache subclass for handling all web requests that use NSURLRequest

EVURLCache What is this? This is a NSURLCache subclass for handeling all web requests that use NSURLRequest. (This includes UIWebView) The EVURLCache

A custom wrapper over AFNetworking library that we use inside RC extensively

AFNetworkingHelper A very simple wrapper over the most amazing networking library for objective C, AFNetworking. We extensively use it inside RC and i

UnsplashProvider - A package that can use the Unsplash API. It was developed as a SwiftUI

UnsplashProvider It is a package that can use the Unsplash API. It was developed

This package is meant to make http request of an easy way inspiren in the architecture of Moya package

NetworkAgent This package is meant to make http request of an easy way inspiren in the architecture of Moya package. This package is 100% free of depe

Comments
  • Delegate runloop blocked -> longer reported ping times

    Delegate runloop blocked -> longer reported ping times

    If the delegate's runloop is blocked (eg. by the user scrolling a UITableView that the delegate updates), the ping time doesn't get calculated until the runloop is unblocked, so the ping time reported can be greatly exaggerated. I need to ensure the ping time calculations happens in a different thread/runloop and is safely queued and reported back to the delegate in its runloop.

    bug 
    opened by cdzombak 1
  • Ping times reported are sometimes inconsistent

    Ping times reported are sometimes inconsistent

    On a 5S (iOS 7.0.3), the ping time is ~90ms slower than shown from OS X's ping.

    On the 64-bit iOS 7 simulator, on the same machine as the ping command, CDZPinger is ~10ms slower.

    opened by cdzombak 0
Owner
Chris Dzombak
Chris Dzombak
Websockets in swift for iOS and OSX

Starscream is a conforming WebSocket (RFC 6455) library in Swift. Features Conforms to all of the base Autobahn test suite. Nonblocking. Everything ha

Dalton 7.5k Jan 4, 2023
Fast Websockets in Swift for iOS and OSX

SwiftWebSocket Conforming WebSocket (RFC 6455) client library for iOS and Mac OSX. SwiftWebSocket passes all 521 of the Autobahn's fuzzing tests, incl

Josh 1.5k Dec 28, 2022
Conforming WebSocket (RFC 6455) client library for iOS and Mac OSX

SwiftWebSocket Conforming WebSocket (RFC 6455) client library for iOS and Mac OS

null 0 Dec 24, 2021
A lightweight, one line setup, iOS / OSX network debugging library! 🦊

Netfox provides a quick look on all executed network requests performed by your iOS or OSX app. It grabs all requests - of course yours, requests from

Christos Kasketis 3.4k Dec 28, 2022
WKZombie is an iOS/OSX web-browser without a graphical user interface.

WKZombie is a Swift framework for iOS/OSX to navigate within websites and collect data without the need of User Interface or API, also known as Headless browser. It can be used to run automated tests / snapshots and manipulate websites using Javascript.

Mathias Köhnke 1.1k Dec 16, 2022
Easy to use SMJobBless, along with a full Swift implementation of the Authorization Services and Service Management frameworks

Leverage SMJobBless functionality with just one function call: let message = "Example App needs your permission to do thingamajig." let icon = Bundle.

null 20 Dec 23, 2022
Easy to use CFNetwork wrapper for HTTP requests, Objective-C, Mac OS X and iPhone

ASIHTTPRequest is an easy to use wrapper around the CFNetwork API that makes some of the more tedious aspects of communicating with web servers easier

Ben Copsey 5.8k Dec 14, 2022
Easy to use OAuth 2 library for iOS, written in Swift.

Heimdallr Heimdallr is an OAuth 2.0 client specifically designed for easy usage. It currently supports the resource owner password credentials grant f

trivago N.V. 628 Oct 17, 2022
The easy way to use sockets on Apple platforms

SwiftSocket SwiftSocket library provides as easy to use interface for socket based connections on server or client side. Supports both TCP and UDP soc

null 1.6k Dec 21, 2022
QwikHttp is a robust, yet lightweight and simple to use HTTP networking library for iOS, tvOS and watchOS

QwikHttp is a robust, yet lightweight and simple to use HTTP networking library. It allows you to customize every aspect of your http requests within a single line of code, using a Builder style syntax to keep your code super clean.

Logan Sease 2 Mar 20, 2022