Skip to content
/ fpingx Public

A swift wrapper of fping which is a high performance ping tool

License

Notifications You must be signed in to change notification settings

jzau/fpingx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A swift wrapper of fping which is a high performance ping tool

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages