Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
4.6k views
in .NET FTP by (280 points)
My code have exception on deleting remote file after downloading the file successful. However, the file in FTP server have been deleted successful, even the last reply code also shown the success transfer. Can anyone help? Thanks.

I found a strange things is that when my app download the remote file using
myFTP.Get(Stream destStream, string remoteFile)
myFTP.Delete(FTPFile.Name)

then the error occured.

however it won't have this exception when downloading the file using
myFTP.Get(string localPath, string remoteFile)
myFTP.Delete(FTPFile.Name)


Below is the error log from my apps.

EnterpriseDT.Net.Ftp.FTPException: Transfer complete. 239 bytes transferred. 239 Bps.
at EnterpriseDT.Net.Ftp.FTPControlSocket.ValidateReply(FTPReply reply, String[] expectedReplyCodes)
at EnterpriseDT.Net.Ftp.FTPClient.Delete(String remoteFile)
at FTPEzyPost.InFTPTWPO.GetFTPFiles(FTPClient myFTP, FTPFile[] myFTPWorkingFiles, String[]& CARDITFileList, String workingDir)

7 Answers

0 votes
by (162k points)
Please post the log file.
0 votes
by (280 points)
The apps log :
2007-08-07 16:03:21,089 [488] ERROR FTPEzyPost.InFTPTWPO (line:0) - Fail to Delete Remote file: 200708071423CX564.TXT
EnterpriseDT.Net.Ftp.FTPException: Transfer complete. 239 bytes transferred. 239 Bps.
at EnterpriseDT.Net.Ftp.FTPControlSocket.ValidateReply(FTPReply reply, String[] expectedReplyCodes)
at EnterpriseDT.Net.Ftp.FTPClient.Delete(String remoteFile)
at FTPEzyPost.InFTPTWPO.GetFTPFiles(FTPClient myFTP, FTPFile[] myFTPWorkingFiles, String[]& CARDITFileList, String workingDir)


The Ftp library log :
2007-08-07 16:03:21,089 [488] DEBUG EnterpriseDT.Net.Ftp.FTPControlSocket (line:0) - ReadReply --> 226 Transfer complete. 239 bytes transferred. 239 Bps.
2007-08-07 16:03:21,120 [488] DEBUG EnterpriseDT.Net.Ftp.FTPControlSocket (line:0) - ReadReply --> 250 DELE command successful.
0 votes
by (280 points)
Is there somebody can suggest a work around if the FTPException cannot be avoid when delete remote after download it using stream method ? Thanks
0 votes
by (162k points)
Please post more of your log files - there is something strange going on with your code. It looks like the delete is receiving the message back from a successful transfer.
0 votes
by (280 points)
From application log
2007-08-09 17:12:41,542 [7524] INFO FTPEzyPost.InFTPTWPO (line:0) - Delete remote file :200708071423CX564.TXT
2007-08-09 17:12:41,542 [7524] INFO FTPEzyPost.InFTPTWPO (line:0) - last reply b4 delete remote file :150, Opening BINARY mode data connection for 200708071423CX564.TXT.
2007-08-09 17:12:41,542 [7524] INFO FTPEzyPost.InFTPTWPO (line:0) - last reply in error delete remote file :150, Opening BINARY mode data connection for 200708071423CX564.TXT.
2007-08-09 17:12:41,558 [7524] ERROR FTPEzyPost.InFTPTWPO (line:0) - Fail to Delete Remote file: 200708071423CX564.TXT

EnterpriseDT.Net.Ftp.FTPException: Transfer complete. 239 bytes transferred. 239 Bps.
at EnterpriseDT.Net.Ftp.FTPControlSocket.ValidateReply(FTPReply reply, String[] expectedReplyCodes)
at EnterpriseDT.Net.Ftp.FTPClient.Delete(String remoteFile)
at FTPEzyPost.InFTPTWPO.GetFTPFiles(FTPClient myFTP, FTPFile[] myFTPWorkingFiles, String[]& CARDITFileList, String workingDir)


From FTP lib log
2007-08-09 17:12:41,292 [4148] DEBUG EnterpriseDT.Net.Ftp.FTPControlSocket (line:0) - Login OK. Proceed.

2007-08-09 17:12:41,292 [4148] DEBUG EnterpriseDT.Net.Ftp.FTPControlSocket (line:0) - EnterpriseDT.Net.Ftp.FTPReply

2007-08-09 17:12:41,292 [4148] DEBUG EnterpriseDT.Net.Ftp.FTPControlSocket (line:0) - Return ValidateReply END

2007-08-09 17:12:41,292 [4148] DEBUG EnterpriseDT.Net.Ftp.FTPControlSocket (line:0) - ReadReply --> 200 Type set to I.
2007-08-09 17:12:41,292 [4148] DEBUG EnterpriseDT.Net.Ftp.FTPControlSocket (line:0) - ReadReply --> 215 UNIX Type: L8
2007-08-09 17:12:41,292 [4148] DEBUG EnterpriseDT.Net.Ftp.FTPControlSocket (line:0) - ReadReply --> 215 UNIX Type: L8
2007-08-09 17:12:41,323 [4148] DEBUG EnterpriseDT.Net.Ftp.FTPControlSocket (line:0) - ReadReply --> 200 Command okay.
2007-08-09 17:12:41,323 [4148] DEBUG EnterpriseDT.Net.Ftp.FTPControlSocket (line:0) - ReadReply --> 150 Opening ASCII mode data connection for file list.
2007-08-09 17:12:41,323 [4148] DEBUG EnterpriseDT.Net.Ftp.FTPControlSocket (line:0) - Return ValidateReply START

2007-08-09 17:12:41,323 [4148] DEBUG EnterpriseDT.Net.Ftp.FTPControlSocket (line:0) - 150

2007-08-09 17:12:41,323 [4148] DEBUG EnterpriseDT.Net.Ftp.FTPControlSocket (line:0) -

2007-08-09 17:12:41,323 [4148] DEBUG EnterpriseDT.Net.Ftp.FTPControlSocket (line:0) - Opening ASCII mode data connection for file list.

2007-08-09 17:12:41,323 [4148] DEBUG EnterpriseDT.Net.Ftp.FTPControlSocket (line:0) - EnterpriseDT.Net.Ftp.FTPReply

2007-08-09 17:12:41,323 [4148] DEBUG EnterpriseDT.Net.Ftp.FTPControlSocket (line:0) - Return ValidateReply END

2007-08-09 17:12:41,542 [4148] DEBUG EnterpriseDT.Net.Ftp.FTPControlSocket (line:0) - ReadReply --> 226 Transfer complete. 78 bytes transferred. 78 Bps.
2007-08-09 17:12:41,542 [4148] DEBUG EnterpriseDT.Net.Ftp.FTPControlSocket (line:0) - Return ValidateReply START

2007-08-09 17:12:41,542 [4148] DEBUG EnterpriseDT.Net.Ftp.FTPControlSocket (line:0) - 226

2007-08-09 17:12:41,542 [4148] DEBUG EnterpriseDT.Net.Ftp.FTPControlSocket (line:0) -

2007-08-09 17:12:41,542 [4148] DEBUG EnterpriseDT.Net.Ftp.FTPControlSocket (line:0) - Transfer complete. 78 bytes transferred. 78 Bps.

2007-08-09 17:12:41,542 [4148] DEBUG EnterpriseDT.Net.Ftp.FTPControlSocket (line:0) - EnterpriseDT.Net.Ftp.FTPReply

2007-08-09 17:12:41,542 [4148] DEBUG EnterpriseDT.Net.Ftp.FTPControlSocket (line:0) - Return ValidateReply END

2007-08-09 17:12:41,542 [4148] DEBUG EnterpriseDT.Net.Ftp.FTPControlSocket (line:0) - ReadReply --> 200 Command okay.
2007-08-09 17:12:41,542 [4148] DEBUG EnterpriseDT.Net.Ftp.FTPControlSocket (line:0) - ReadReply --> 150 Opening BINARY mode data connection for 200708071423CX564.TXT.
2007-08-09 17:12:41,542 [4148] DEBUG EnterpriseDT.Net.Ftp.FTPControlSocket (line:0) - Return ValidateReply START

2007-08-09 17:12:41,542 [4148] DEBUG EnterpriseDT.Net.Ftp.FTPControlSocket (line:0) - 150

2007-08-09 17:12:41,542 [4148] DEBUG EnterpriseDT.Net.Ftp.FTPControlSocket (line:0) -

2007-08-09 17:12:41,542 [4148] DEBUG EnterpriseDT.Net.Ftp.FTPControlSocket (line:0) - Opening BINARY mode data connection for 200708071423CX564.TXT.

2007-08-09 17:12:41,542 [4148] DEBUG EnterpriseDT.Net.Ftp.FTPControlSocket (line:0) - EnterpriseDT.Net.Ftp.FTPReply

2007-08-09 17:12:41,542 [4148] DEBUG EnterpriseDT.Net.Ftp.FTPControlSocket (line:0) - Return ValidateReply END

2007-08-09 17:12:41,542 [7524] DEBUG EnterpriseDT.Net.Ftp.FTPControlSocket (line:0) - ReadReply --> 226 Transfer complete. 239 bytes transferred. 239 Bps.
2007-08-09 17:12:41,589 [7524] DEBUG EnterpriseDT.Net.Ftp.FTPControlSocket (line:0) - ReadReply --> 250 DELE command successful.


Our app will login remote server first and list out the total no of files, then loop through those remote files and dowload. If success download the file then delete that remote file immediately. In the past, we use the method using both remote filename and local filename. After we try to use the method using memory stream and remote filename, then FTPException occurred. One more things is that when using the Get(stream, remotefilename) method, the local file was not found even no exception thrown..
Please help. Thanks.
0 votes
by (162k points)
I don't understand your log file. It seems to only have server replies, which tells us very little. Can you please do this:

import com.enterprisedt.util.debug.*;

Logger.setLevel(Level.ALL);
Logger.addAppender(new FileAppender("logfile.txt"));

at the start of your program.

Please email your log file to support at enterprisedt dot com and we'll take a look at it.
0 votes
by (280 points)
The problem is solved, it should related to accessing the closed stream object and throw the exception. Thanks your help

Categories

...