samedi 9 juillet 2016

iOS Swift2.2 testing reachable on host IP


So I'm still trying to check if a host is reachable. All solutions i've found so far just check if there is a network connection but not if a certain host is available..

Tried a lot of different things, thats where I am at the moment:

   private static func networkAvailable1()  {
        let networkStateHost: Reachability.NetworkStatus
        do{
        let hostReachability = try Reachability.init(hostname:"apple.com").currentReachabilityStatus
        print(hostReachability)
            let hostReachability1 = try Reachability.init(hostname:"localhost:8080").currentReachabilityStatus
            print(hostReachability1)
        }

            catch {
                print("Unable to create Reachability")

            }

Aucun commentaire:

Enregistrer un commentaire