Re-establishing networking on wake from sleep
Re-establishing networking on wake from sleep
- Subject: Re-establishing networking on wake from sleep
- From: John Timmer <email@hidden>
- Date: Sun, 16 Mar 2003 17:03:35 -0500
Greetings -
I've got an app that catches a wake from sleep event, and tries to update
some network information shortly thereafter. In order to give the computer
a bit of time to wake up everything needed to network, I've added a
"sleep()" call to stall for a bit. For whatever reason, even sleeping for
10 seconds before checking whether the network is accessible doesn't seem to
allow enough time. The code I use to check for network accessibility is
taken straight from some Apple sample code:
result = NO;
if ( SCNetworkCheckReachabilityByName([[NSString
stringWithString:@"www.some_server.com"] cString], &flags) ) {
result = (flags & kSCNetworkFlagsReachable);
}
return result;
This code works fine when the computer is fully awake. This is mostly being
done with a DHCP-based configuration - is the problem that I need a bit of
time to pick up my configuration, or that the code above won't force DHCP to
do its magic?
Any advice is appreciated,
John
_______________________________________________
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.