Re: Determining Network Server Reachability
Re: Determining Network Server Reachability
- Subject: Re: Determining Network Server Reachability
- From: Greg Parker <email@hidden>
- Date: Wed, 20 Jun 2007 22:15:25 -0700
Daniel Ellis wrote:
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.
Neither SCNetworkCheckReachabilityByName() nor
SCNetworkCheckReachabilityByAddress() can tell you whether you can
successfully communicate with a given machine. The only reliable way
to do that is to try to communicate with that machine.
'"Reachability" reflects whether a data packet, sent by an application
into the network stack, can leave the local computer. Note that
reachability does not guarantee that the data packet will actually be
received by the host.'
http://developer.apple.com/documentation/Networking/Reference/SysConfig/SCNetwork/CompositePage.html
In practice, reachability is true if the address given is a LAN
address and the local machine has an interface using Bonjour, or the
address given is a global Internet address and the local machine has
(or thinks it could establish by dialup) a connection to some Internet
router. This doesn't mean that the network between the two machines is
working, that the remote machine is listening or capable of
responding, or that the firewalls in between would allow your
particular packets through.
--
Greg Parker email@hidden Runtime Wrangler
_______________________________________________
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