in reply to Detecting An Open File

A possible solution would be to test size of file and if it doesn't change for a time longer than the timeout of the connection, then the file is closed. Of course, you can't tell if the file is complete or the connection has timed out.
A better solution would be to receive another file with checksum and size of the file to be transferred.
This topic has been discussed some time ago at looking for perl module which returns if a file is open; the module for Linux will probably change due to a different implementation of /proc fs in Linux v2.6.

HTH, Valerio