Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FTP issue 1

Status
Not open for further replies.

smugindividual

Programmer
Apr 14, 2003
104
US
I have run into a situation where a polling application is seeing and processing a file that have been FTPed but has not completed yet. The polling app is seeing these as incomplete transactions and is discarding them. Meanwhile on the sending side, ftp will hang with no explanation.

Is there anyway to set FTP into a blocking mode where the resulting file cannot be seen/touched until the transmission is complete?

 
not that I'm aware of. You may want to consider an ftp's "rename" command as a work-around.

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
A possibility. But the problem then becomes that I'm not the one involved with the FTP, I'm just told that files will appear in a certain directory and they will be FTPed there.

The current work around is that the routine used to process these files is verifying each file by looking for a file delimiter, and if its missing waits for a configurable amount of time and checks again, if its still incomplete discards it. But obviously this slows down the whole process.

At first i was excited to see that FTP offered a MODE option that could be set to streaming, block, and compressed. Unfortunatly block doesnt mean blockING.

Thanks for the help anyways though.
 
I don't quite understand you meant by the 'file delimiter', but....

An alternative might be: the 'consumer' routine can keep checking 'fuser fileName'. If there're no 'producers' [ftp] - get the file. If there is/are producers [ftp], postpone and try again later [timing out eventually].

Just an idea.



vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
You also might trying checking the size of the file every 2-3 seconds and consider it "ready" when the size hasn't changed in a certain number of passes.
 
Thanks for the suggestions. I found a unix command that I can use, "fuser" returns the PID and username of a file if it is currently being accessed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top