• 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: Networking and sleep
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Networking and sleep


  • Subject: Re: Networking and sleep
  • From: Lorenzo Thurman <email@hidden>
  • Date: Thu, 12 Apr 2012 09:48:31 -0500

On Apr 12, 2012, at 9:33 AM, Fritz Anderson wrote:

> On 10 Apr 2012, at 4:41 PM, Lorenzo Thurman wrote:
>
>> I have an app which attempts to make an internet connection after receiving an NSWorkspaceDidWake notification. Most of the time, the connection fails with the error, "...internet connection appears to be offline (-1009)". My guess is the the OS has not yet reinitialized networking before my app attempts to connect. So I added a sleepForInterval:10 to make my app wait a bit before connecting. This seems to work just fine, but question is:
>> Is there a more elegant way to handle this?
>
> Use the (C-level) SCNetworkReachability API to register for callbacks to notify you of loss and acquisition of network availability. Search for SCNetworkReachabilitySetCallback, and work outward from there.
>
> 	— F
>


Great, I'll do that. Thanks!

"...Business! Mankind was my business. The common welfare was my business; charity, mercy, forbearance, and benevolence, were all my business. The dealings of my trade were but a drop of water in the comprehensive ocean of my business!"

Marly's ghost - A Christmas Carol


Lorenzo Thurman
email@hidden




_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >Networking and sleep (From: Lorenzo Thurman <email@hidden>)
 >Re: Networking and sleep (From: Fritz Anderson <email@hidden>)

  • Prev by Date: AVAssetWriterInputPixelBufferAdaptor on IOS attempting to write images to a video
  • Next by Date: Webview cache location
  • Previous by thread: Re: Networking and sleep
  • Next by thread: Question about block, ARC, self, and reference counting.
  • Index(es):
    • Date
    • Thread