-1

I'm using the Reachability class from apples demo projects to ping some servers pages. But no matter what I write in URL I always get ReachableViaWiFi.

Reachability* reachability = [Reachability reachabilityWithHostName:URL];
NetworkStatus netStatus = [reachability currentReachabilityStatus];

I'm connected to a Wifi, but I just want to check if some servers are available or not. (With the answer "NO" if I'm disconnected from the net).

Any suggestions please, even with others classes with the same goal.

Thanks

Tobi Nary
  • 4,566
  • 4
  • 30
  • 50
Talkanian
  • 19
  • 1
  • 5
  • The tags you were using are not appropritate for this question. Please review [What are tags, and how should I use them?](//stackoverflow.com/help/tagging) – Tobi Nary Jan 27 '16 at 16:26

1 Answers1

1

From the docs:

A remote host is considered reachable when a data packet, sent by an application into the network stack, can leave the local device. Reachability does not guarantee that the data packet will actually be received by the host.

Edit: So, if there is a route available (whether the server is actually listening or not), it return that route's quality, in your case WiFi.

How about just sending your request and checking out the result?

As to your question for another library: Those questions are deemed off topic here.

Tobi Nary
  • 4,566
  • 4
  • 30
  • 50
  • Thank you for your answer! The fact is, that i don't know what kind of server i will get at that point, so i need to do a generic "ping" to test his "operativity" (more then reachability). Is there a class who allow me to do that? (synchrounosly) – Talkanian Jan 27 '16 at 16:49
  • First of all, do not network on the main thread. Also, you can do low level networking with CoreFoundation (CFNetworking). For third-party libraries, refer to the "off-topic" part of my answer. – Tobi Nary Jan 27 '16 at 17:06