Re: Detecting Internet
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