A wrapper of fping which is a high performance ping tool. More information about fping is available here.
add the following line to your Podfile:
pod "fpingx"
github "jzau/fpingx"
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?
}
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