Re: Notification when network volume disappears
Re: Notification when network volume disappears
- Subject: Re: Notification when network volume disappears
- From: vincent habchi <email@hidden>
- Date: Tue, 15 Jun 2010 08:50:52 +0200
Le 14 juin 2010 à 20:37, Jens Alfke a écrit :
> Last I heard (admittedly, a few years ago) there wasn’t any good way to do async/nonblocking filesystem operations. The standard system calls block; the O_NONBLOCK mode for fcntl only works on network socket streams; and the AIO API has (had?) significant issues.
You can try also to set a background thread that sends periodic pings (ICMP packets) to the IP you are writing to, e.g. every second. If you register more than 5 errors in a raw, then you can (maybe) assume your link is down. That's how ping(1) works.
You would maybe have to adjust your timeout depending on the number of hops (you can get it in the returned ICMP echo): whereas in a local network it is safe to assume than a five second interruption means a breakdown somewhere, if you're writing over the Internet, this is obviously wrong.
As for the removal of the cable on the local machine, there must be some way Cocoa is informed (utilities exists at the BSD level).
Vincent_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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