Skip to content

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 <[email protected]>

The original author: Roland Schemers ([email protected]) Previous maintainer: RL "Bob" Morgan ([email protected]) Initial IPv6 Support: Jeroen Massar ([email protected] / [email protected]) 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