• 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: Connected to the internet or not?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Connected to the internet or not?


  • Subject: Re: Connected to the internet or not?
  • From: Angela Brett <email@hidden>
  • Date: Sun, 24 Mar 2002 08:06:28 +1200

Hi everyone

Has anyone got a method to test whether or not there is currently a
connection to the internet or not. I need these to produce an alert if there
is not as my function requires internet access.

I have SystemConfiguration.framework added to my project, and I use this function:

BOOL networkReachableWithoutAnythingSpecialHappening(void) {
Boolean Success;
SCNetworkConnectionFlags ReachabilityStatus;
Success = SCNetworkCheckReachabilityByName("www.apple.com", &ReachabilityStatus);
return (Success && (ReachabilityStatus & 3));
}

to check whether I can reach the internet without doing anything special like dialling up. You might want to change the 3 to something else depending on how you want your program to behave - read SCNetwork.h in the SystemConfiguration.framework for details.
--
Angela Brett email@hidden http://acronyms.co.nz/angela
A mathematician is a machine for turning coffee into theorems -- Paul Erdos
_______________________________________________
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: 
 >Connected to the internet or not? (From: David Ahmed <email@hidden>)

  • Prev by Date: Re: Connected to the internet or not?
  • Next by Date: Re: HTML link from TextView
  • Previous by thread: Re: Connected to the internet or not?
  • Next by thread: Cocoa and UNIX txt files ??
  • Index(es):
    • Date
    • Thread