• 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: Monitoring host reachability and the SCNetwork API
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Monitoring host reachability and the SCNetwork API


  • Subject: Re: Monitoring host reachability and the SCNetwork API
  • From: Allan Nathanson <email@hidden>
  • Date: Thu, 16 Apr 2009 14:20:59 -0400

Can you provide a bit more "code"?

... and what version of the OS are you testing on / targetting?

Also, what do you get from "scutil -d -v -r google.com"?

- Allan


On Apr 16, 2009, at 2:02 PM, Jeremy W. Sherman wrote:

Hello all,

I wish to monitor reachability of a host and receive a callback if its
reachability changes. It seemed the System Configuration framework
provided just what I needed. But a simple test appears to indicate
that the framework is unreliable for my purposes.

I am connected to the Internet. But checking reachability of
google.com via SCNetworkCheckReachabilityByName("google.com", &flags)
yields flags of 0x0002, kSCNetworkConnectionRequired. The results of
using an SCNetworkReachability installed on the runloop agree: a
connection is required, and cannot be automatically established.

The documentation for the ConnectionRequired flag states: "This flag
indicates that the specified nodename or address can be reached using
the current network configuration, but a connection must first be
established. As an example, this status would be returned for a dialup
connection that was not currently active, but could handle network
traffic for the target system." Even if a connection did have to be
established, I would expect kSCNetworkConnectionAutomatic to be set.

I was interpreting the returned reachability flags as "the host can be
reached if it is ((Reachable or ConnectionAutomatic) and not
InterventionRequired)"; this does not seem to work, because
SystemConfiguration appears unaware of my actual connection status and
current network reachability.

Is there a better, working way to monitor the reachability of a host?
I can use anything daemon-safe (so pretty much Foundation.framework on
down).

Also, did I misunderstand something about SystemConfiguration's
reachability API, or is it just unhelpful/stuck in a dial-up age?
_______________________________________________
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


References: 
 >Monitoring host reachability and the SCNetwork API (From: "Jeremy W. Sherman" <email@hidden>)

  • Prev by Date: Monitoring host reachability and the SCNetwork API
  • Next by Date: Re: Monitoring host reachability and the SCNetwork API
  • Previous by thread: Monitoring host reachability and the SCNetwork API
  • Next by thread: Re: Monitoring host reachability and the SCNetwork API
  • Index(es):
    • Date
    • Thread