Detecting Internet
Detecting Internet
- Subject: Detecting Internet
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Mon, 26 Jun 2006 22:20:18 +0200
I have an app which needs to get informed of changes in internet
connectivity.
Currently I am doing:
- (void)timerInterrupt: (NSTimer *)theTimer ; // called every second
{
BOOL nowConnected = [ NSHost hostWithName:
@"time.asia.apple.com" ] != nil ;
if ( nowConnected == connected ) return;
connected = nowConnected;
if ( connected ) [ self startOfConnection ] else [ self
endOfConnection ] ;
}
This works, but it somehow does not look very nice.
1. is there a better way to detect an internet connection than
hostWithName ?
2. is there a better way to get startOfConnection and endOfConnection ?
Kind regards
Gerriet.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden