Skip to content

Latest commit

 

History

History
83 lines (52 loc) · 1.83 KB

README.md

File metadata and controls

83 lines (52 loc) · 1.83 KB

fpingx

Language CocoaPods Carthage Compatible CocoaPods

A wrapper of fping which is a high performance ping tool. More information about fping is available here.

Installation

CocoaPods

add the following line to your Podfile:

pod "fpingx"

Carthage

github "jzau/fpingx"

Usage

import fpingx

fpingx.ping(hosts: ["google.com", "baidu.com", "apple.com", "abc.c"], progress: { (progress) in
    print(progress)
}) { (result) in
    print(result)
}

The progress is a float number between 0-1.

The result is a dictionary which key is host string, value is FpingxResult.

Notice that FpingxResult is a struct defined as:

public struct FpingxResult {

    public let host: String

    /// number of sent
    public let xmt: Int

    /// number of received
    public let rcv: Int

    /// loss percentage (value from 0-100)
    public var loss: Int {
        return xmt > 0 ? (xmt - rcv) * 100 / xmt : 0
    }

    /// nil if rcv is 0
    public let avg: Int?

    /// nil if rcv is 0
    public let min: Int?

    /// nil if rcv is 0
    public let max: Int?

}

Author

jzau (Twitter: @Jie)

Credits of fping

Current maintainer: David Schweikert <david@schweikert.ch>

The original author: Roland Schemers (schemers@stanford.edu) Previous maintainer: RL "Bob" Morgan (morgan@stanford.edu) Initial IPv6 Support: Jeroen Massar (jeroen@unfix.org / jeroen@ipng.nl) Other contributors: see ChangeLog