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 question 1

Status
Not open for further replies.

smugindividual

Programmer
Apr 14, 2003
104
US
If I am FTPing files from machine A to machine B what happens if machine B is rebooted before the transfer is completed?

Does it abort and leave a partial transfer?
Does it keep trying until a timeout is reached?



 
It aborts and leaves a partial transfer. Checking the validity of FTP transfers is non trivial because if the transfer fails for any reason (host reboots, network failure, file system full) the FTP process still returns 0 to the OS.

If it is important to check that the file transferred correctly (which I assume is the root of your question) then the only method I know of is to
1) put the file
2) retreive the file with a new name
3) use diff (or equivalent) to check returned file is identical to sent file

If the file returned is the same as the file sent then you can assume that the sent file was received correctly. Of course if the file is big.......


Columb Healy
 
thanks for the quick response.

My issue is that i'm trouble shooting an issue from the recieving end and have no access to the system that is sending the files. They ftp over groups of files that all follow a sequential order and on my end we process those files. Pretty basic, but we've been seeing the processing comming out of order in instances when the processing machine was rebooted.

This helped me narrow down what to look for in the code, thank you again.
 
If I'm forced into using automated FTP, I have the sending party PUT the datafile, and afterwards PUT a checkfile, containing at least the name of the datafile and the number of records. So I can verify at the receiving end that the received file contains the correct number of lines. Pretty basic as it is, but better than nothing.

On sending a file, I verify the ftp status codes e.g. check for "226 Transfer complete"

Also I do a dir on the file I just PUT to check if the file is newly written and has the correct number of bytes. Note: account for NL to CRLF conversion: 1 byte extra per record if sending from unix to windows, other type of servers may result in other conversions, so you need to experiment a bit...


HTH,

p5wizard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top