naptics / PlainPing

a very plain ping interface in swift
MIT License
58 stars 21 forks source link

Several ping simultaneously #20

Open fs-bonlook opened 6 years ago

fs-bonlook commented 6 years ago

Hi,

If I ping several domains simultaneously, just the faster site call the completion block. The others are missing ...

Sample:

func pingGoogle() {
    print("START PING GOOGLE")
    PlainPing.ping("www.google.com", withTimeout: 1.0, completionBlock: { (timeElapsed:Double?, error:Error?) in
        print("END PING GOOGLE")
    })
}
func pingAmazon() {
    print("START PING AMAZON")
    PlainPing.ping("www.amazon.com", withTimeout: 1.0, completionBlock: { (timeElapsed:Double?, error:Error?) in
        print("END PING AMAZON")
    })
}
// ------
pingGoogle()
pingAmazon()
// ------