How to deal with unplug from the LAN

Sivakatirswami katir at hindu.org
Tue May 25 16:20:03 EDT 2010


I'm working on an app that requires a remote volume to be mounted (Mac 
OS X 10.6)

I use several basic connectivity tests like

put hostAddressToName ("11.11.11.11:") into the server

# If I get DNS from the XServe box I know the user is at least plugged 
in or has his Airport connection uup and running..

# next, get a ping file which is a little file containing the word "true"

command CheckForServerIs Mounted
    put url "file:/volumes/XServer/Sites/public_html/ping.txt" into 
tPingTest
  if tPingTest is "True" then
   set the enabled of button "connected" to true (small animated gif 
that show a live connection"
   put "true" into gConnectedToLanServer # a global for later testing.
  else
   answer "Sorry, the server is not mounted.. shall I mount it for 
you?"  with "No" or "Yes"
  # run afp apple script here to mount the remote volume.

  end if

end CheckForServerIsMounted


OK the above works fine if the user is a "Tidy Boy" and is careful to 
dismount the volume, but if he just up and pulls the ethernet cable out 
with the remote volume mounted and runs off to the dentist with his lap 
top... if he has my app open and tries anything, it goes into a 3 minute 
wait...( this is actually a long standing nuisance with Apple's API to 
the network framework... and can happen with pretty much any other app 
and not just RunRev) *finally* after  3 minutes, the system seems to 
realize he's cut off, gives up, and gives the CPU back to RunRev...my 
dialog pop's up to offer the user the option to mount. But because he's 
unplugged, his is informed he is off line and he's gracefully left to 
work off line...

So, this all works well, but the part where I am unable to test for if 
the user just pulled out his ethernet cable with the volume still 
mounted, without this long hang up...

Any ideas?

Sivakatirswami



More information about the use-livecode mailing list