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

Re: Detecting network change


  • Subject: Re: Detecting network change
  • From: Greg <email@hidden>
  • Date: Thu, 23 Oct 2008 17:51:46 -0400


On Oct 23, 2008, at 5:38 PM, Josh Graessley wrote:

The SCDynamicStore APIs are available on the desktop but not on the iPhone/iPod Touch.


If you use SCNetworkReachabilityCreateWithName or SCNetworkReachabilityCreateWithAddress for general reachability and follow up with SCNetworkReachabilityCreateWithAddressPair when you have established a connection, SCNetworkReachabilityCreateWithAddressPair will notify you when the local address is no longer useful. If you have access to the socket, you can use getsockname and getpeername to get the values for SCNetworkReachabilityCreateWithAddressPair. If you're using one of those fancy high level frameworks, you may have no access to the socket. Ideally there would be events directly on the socket to let you know about changes that may be relevant or SCNetworkReachabilityCreateWithSocket that would look at the state of the connected socket and figure out the nitty gritty details.

-josh

Perfect. This sounds like exactly what I need. I'm using low-level sockets and getsockname already so this should fit in neatly.


Ideally there would be events directly on the socket to let you know about changes that may be relevant

I'm surprised by the current behavior of the sockets. I'm using asynchronous sockets and calling recv() or send() on them does not result in any serious error on errno after switching jumping networks, which is bizarre and the reason I started looking outside the BSD socket API in the first place. I'm curious as to why they don't do that...


Thanks again for your reply, my plan is to modify the "Reachability" example to use SCNetworkReachabilityCreateWithAddressPair(), if you don't hear back from me it means everything worked! :-D

- Greg
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Detecting network change
      • From: Josh Graessley <email@hidden>
References: 
 >Detecting network change (From: Greg <email@hidden>)
 >Re: Detecting network change (From: Jens Alfke <email@hidden>)
 >Re: Detecting network change (From: Greg <email@hidden>)
 >Re: Detecting network change (From: "Shawn Erickson" <email@hidden>)
 >Re: Detecting network change (From: Josh Graessley <email@hidden>)

  • Prev by Date: Re: Detecting network change
  • Next by Date: Re: Detecting network change
  • Previous by thread: Re: Detecting network change
  • Next by thread: Re: Detecting network change
  • Index(es):
    • Date
    • Thread