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

Monitoring host reachability and the SCNetwork API


  • Subject: Monitoring host reachability and the SCNetwork API
  • From: "Jeremy W. Sherman" <email@hidden>
  • Date: Thu, 16 Apr 2009 14:02:57 -0400

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?

Thanks,

—Jeremy
 _______________________________________________
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: Monitoring host reachability and the SCNetwork API
      • From: Jeff Johnson <email@hidden>
    • Re: Monitoring host reachability and the SCNetwork API
      • From: Allan Nathanson <email@hidden>
  • Prev by Date: Re: Client-side SSL on iPhone?
  • Next by Date: Re: Monitoring host reachability and the SCNetwork API
  • Previous by thread: Re: Client-side SSL on iPhone?
  • Next by thread: Re: Monitoring host reachability and the SCNetwork API
  • Index(es):
    • Date
    • Thread