Skip navigation.
 
mlRe: Detecting Internet
FROM : Gerriet M. Denkmann
DATE : Fri Jul 14 23:06:01 2006

On 14.07.2006, at 17:49, Jerry Krinock <<email_removed>> wrote:

>
> on 06/07/14 2:12, Gerriet M. Denkmann at <email_removed> 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.

Related mailsAuthorDate
mlDetecting Internet Gerriet M. Denkman… Jul 14, 11:12
mlRe: Detecting Internet Jerry Krinock Jul 14, 15:25
mlRe: Detecting Internet Adam R. Maxwell Jul 14, 15:33
mlRe: Detecting Internet Gerriet M. Denkman… Jul 14, 23:06
mlRe: Detecting Internet Jerry Krinock Jul 15, 02:01
mlRe: Detecting Internet Gerriet M. Denkman… Jul 15, 07:57
mlRe: Detecting Internet Jerry Krinock Jul 15, 21:47