Re: Is the internet avaliable question
Re: Is the internet avaliable question
- Subject: Re: Is the internet avaliable question
- From: Peter Borg <email@hidden>
- Date: Fri, 2 Apr 2004 08:13:04 +0200
I really don't know if it is better to use NSHost or not but I use the
System Configuration framework and it works for me. This is the code I
use:
BOOL success;
BOOL connected;
SCNetworkConnectionFlags status;
success = SCNetworkCheckReachabilityByName("www.apple.com", &status);
connected = success && (status & kSCNetworkFlagsReachable) && !(status
& kSCNetworkFlagsConnectionRequired);
if (connected) {
NSLog(@"You are connected");
} else {
NSLog(@"You are not connected");
}
Be sure to add the SystemConfiguration.framework to the project and
include at the top:
#import <SystemConfiguration/SCNetwork.h>
Peter Borg
On 2004-04-02, at 02.35, Kevin Bracey wrote:
I'm developing a small support app to load a web page in the default
browser. This works great.
This is for Panther users only. Written in Cocoa with xCode.
I would like to check if the internet is available before attempting
to load the page. Some users will be on a LAN, others will be on
dial-up. I just want check if the internet is available and prompt
them to logon if not.
Is NSHost the easy and robust way to do this? for which I have the
apple sample "NameAndAddress"
or should I use
The System Configuration framework, of which I have found no samples,
and it looks like it would take me (newbie) some time to fathom.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.