Determining Network Server Reachability
Determining Network Server Reachability
- Subject: Determining Network Server Reachability
- From: "Daniel Ellis" <email@hidden>
- Date: Wed, 20 Jun 2007 21:30:25 -0700
I'm working on a project that needs to unmount network volumes occasionally.
But, I'm trying to find a way to make sure that the volume's server is
still reachable before unmounting to avoid hanging the system by referencing
something that isn't reachable anymore (e.g. trying to unmount a mounted AFP
share whose server has gone to sleep).
SCNetworkCheckReachabilityByName() seems to work as advertised for servers
that are designated by name. However, using the analogous
SCNetworkCheckReachabilityByAddress( ) always seems to return true, even if
the given IPv4 address is something that is obviously not on the network.
Here's the code:
// See if the server can be reached by IPv4 address.
success = SCNetworkCheckReachabilityByAddress(&addr, addressLength,
&status);
// Set the flag accordingly.
reachable = success && (status & kSCNetworkFlagsReachable);
So, does anyone know a reliable way of checking to see if a remote host is
reachable? It seems to be a bit of a hole in the cocoa API's.
Any advice is much appreciated.
Daniel
_________________________________________________________________
Dont miss your chance to WIN $10,000 and other great prizes from Microsoft
Office Live http://clk.atdmt.com/MRT/go/aub0540003042mrt/direct/01/
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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