LiveCode FTP Hanging in Some Instances
gregory.lypny at videotron.ca
Mon Sep 12 09:36:46 EDT 2011
Once again, I am trying to weed out the few remaining, infrequent bugs that have cropped up in a little FTP app that I have developed for my students. The app is working fine in that almost 100 students have been able to run it on their Macs or PCs, sign in, create an account on my server (my office Mac), respond to a questionnaire (a simple experiment requiring a choice), and submit trial answers to a quiz.
However, three students have gotten back to me reporting that the app starts up but hangs when trying to connect to the FTP site. They say that the program freezes on “Connecting...”. Below is a snippet of the startup procedure. You can see that the first line is the message “Connecting...” put in a field to let users know what is happening. The rest is equally simple (famous last words). The handler starts using a library stack that contains two handlers that are referenced during start up. One is a function, isConnected(), that confirms whether the computer is connected to the Internet by returning True or False; the other is a command, cleanLineEndings, that ensures that all of the line endings in the files being downloaded use Return.
isConnected() is in the last block of code in the snippet. My guess as to the problem is that the students experiencing it are Windows users, and that they have moved the app file out of the folder in which the library file resides, When isConnected() is called, I assume that nothing is returned because the function can’t be found, and because I’ve only included False in my If statement, there isn’t a condition to exit when nothing is returned. Could the missing library be causing the problem? If so, all I have to do is expand the conditions in that last block. But wouldn’t a call to a function that can't be found generate an error message from the engine?
# Startup Procedure
put “Connecting...” into fld “Message"
start using stack "LP Library"
libURLSetLogField the long id of fld "FTP Log" of card "Connection" of stack “Connection"
get fld "FTP Addresses" of card "Connection" of stack "Connection"
split it by return and comma
set the cFTPAddressArray of stack "Connection" to it
put the cFTPAddressArray of stack "Connection" into aFTPAddress
# Registration Information
put url ("ftp://" & aFTPAddress["Students Folder"]) into students
filter students without ".DS_Store"
—And so on until
# Internet Connection
-- To work, the app needs to be connected to the Internet and have access to the registration and accounts files
if not isConnected()
go to card "Not Connected"
if students is empty or accounts is empty or instructors is empty
go to card "Student List Not Available"
— And then more stuff
More information about the Use-livecode