Re: Connected to the internet or not?
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.