• 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: Is the internet avaliable question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


References: 
 >Is the internet avaliable question (From: Kevin Bracey <email@hidden>)

  • Prev by Date: Re: Subclass of NSPopUpButton and Bindings
  • Next by Date: An NSShadow question
  • Previous by thread: Is the internet avaliable question
  • Next by thread: Re: Is the internet avaliable question
  • Index(es):
    • Date
    • Thread