• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Detecting Internet
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Detecting Internet


  • Subject: Re: Detecting Internet
  • From: "Gerriet M. Denkmann" <email@hidden>
  • Date: Fri, 14 Jul 2006 23:06:01 +0200


On 14.07.2006, at 17:49, Jerry Krinock <email@hidden> wrote:


on 06/07/14 2:12, Gerriet M. Denkmann at email@hidden wrote:

Any hints would be very welcome.

I'm embarassed to post this, because it is so crude, but it always works:
Create and load an NSURLConnection. If you're not connected to the
internet, you immediately get an NSURLResponse with a -1009 status code.

Just tried it.

My Apple-Menu -> Location has two locations: "Near Phone" and "Near Computer"

"Near Phone" : System Preferences -> Network -> Network Status shows:
Internal Modem is configured, but not connected. It i set up to dial "1234..."
Build-In Ethernet has Configure IPv4 Manually.


"Near Computer" : System Preferences -> Network -> Network Status shows:
Internal Modem is not set up
Build-In Ethernet has Configure IPv4 Using DHCP
And the computer is connected via ethernet to some other computer, which has a modem.


With Location "Near Phone" and the modem not connected, I get immediately 1009 like you said.

With Location "Near Computer" and the other computer (which has a modem) has this modem not connected, I get 1001 timeout after, well, some timeout.

I use:
SCNetworkReachabilityCreateWithName(NULL, "ntp"), SCNetworkReachabilitySetCallback
SCNetworkReachabilityScheduleWithRunLoop
to get informed about changes in network connectivity.


In Location "Near Phone" this works perfectly:
with a new connection I get flags = 0; and when the connection is closed I get TransientConnection + Reachable + ConnectionRequired.


But in Location "Near Computer" I never get any notices about changes in network connectivity.


So, again the question: How can I recognize a Location like my "Near Computer" where a non-existing connection can obviously only detected by trying to connect and waiting for some timeout.


I do not want any timeouts at all.

Gerriet.


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Detecting Internet
      • From: Jerry Krinock <email@hidden>
  • Prev by Date: Spotlight Importer Not Found in App Bundle
  • Next by Date: Re: peekaboo, icu
  • Previous by thread: Re: Detecting Internet
  • Next by thread: Re: Detecting Internet
  • Index(es):
    • Date
    • Thread