• 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
Detecting Internet
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Detecting Internet (w/code, part 1)
      • From: John Pannell <email@hidden>
    • Re: Detecting Internet
      • From: Ricky Sharp <email@hidden>
  • Prev by Date: Re: Person experienced with auth services needed
  • Next by Date: [ANN] -- Atimi seeks Cocoa programmer/contractor
  • Previous by thread: Re: NSTextField and controlTextDidEndEditing
  • Next by thread: Re: Detecting Internet
  • Index(es):
    • Date
    • Thread