Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
1.7k views
in .NET FTP by (120 points)

1 Answer

0 votes
by (162k points)
edited by
This is bizarre. Is it possible that the file is being truncated on the server while you are downloading?

Have you tried using FIlezilla, and if so, was it successful?
by (120 points)
Let me try again
by (120 points)
Okay, now i can post code.  I kept getting errors from the server.

This is the code:

 var ftp = new FTPConnection()
            {
                ConnectMode = FTPConnectMode.PASV,
                ServerAddress = CitFtpSite,
                UserName = CitUserName,
                Password = CitPassword,
                TransferType = FTPTransferType.BINARY,
                ServerDirectory = "/Outbox"
            };
            ftp.Connect();
            FTPConnection.LogLevel  = LogLevel.Debug;
            FTPConnection.LogFile = @"P:\logs.txt";
        var filename = Environment.CurrentDirectory +@"\"+ string.Format("CCData{0:MMddyyhhMMss}.txt",DateTime.Now);
            //try
            {
                ftp.DownloadFile(filename,"CCDATA.TXT");
            }

When I get the error, I get this log entry:

DEBUG [FTPConnection] 8 Sep 2015 09:37:17.027 : DownloadFile(C:\Projects\Badger Central\Source\Feature\0823\Factoring\Badger.Core.Services.Tests\bin\Debug\CCData090815090917.txt,CCDATA.TXT)
DEBUG [FTPControlSocket] 8 Sep 2015 09:37:17.030 : ---> REST 0
DEBUG [FTPControlSocket] 8 Sep 2015 09:37:17.076 : 350 Restarting at 0. Send STORE or RETRIEVE
DEBUG [FTPControlSocket] 8 Sep 2015 09:37:17.081 : ---> PASV
DEBUG [FTPControlSocket] 8 Sep 2015 09:37:17.133 : 227 Entering Passive Mode (206,212,89,52,120,228)
DEBUG [FTPControlSocket] 8 Sep 2015 09:37:17.134 : Server supplied address=206.212.89.52
DEBUG [FTPControlSocket] 8 Sep 2015 09:37:17.134 : Server supplied port=30948
DEBUG [FTPControlSocket] 8 Sep 2015 09:37:17.134 : autoPassiveIPSubstitution=True
DEBUG [FTPControlSocket] 8 Sep 2015 09:37:17.134 : remoteAddr=206.212.89.52
DEBUG [FTPControlSocket] 8 Sep 2015 09:37:17.135 : Substituting server supplied IP (206.212.89.52) with remote host IP (206.212.89.52)
DEBUG [FTPControlSocket] 8 Sep 2015 09:37:17.135 : NewPassiveDataSocket(206.212.89.52,30948)
INFO [BaseSocket] 8 Sep 2015 09:37:17.136 : Connecting to 206.212.89.52:30948 with timeout 120000 ms
DEBUG [BaseSocket] 8 Sep 2015 09:37:17.178 : Successfully connected to 206.212.89.52:30948
DEBUG [FTPControlSocket] 8 Sep 2015 09:37:17.178 : Connected
DEBUG [FTPControlSocket] 8 Sep 2015 09:37:17.178 : ---> RETR CCDATA.TXT
DEBUG [FTPControlSocket] 8 Sep 2015 09:37:17.391 : 554 Invalid REST argument.
INFO [FTPControlSocket] 8 Sep 2015 09:37:17.392 : Expected reply codes = [125,150] (strict=False)
ERROR [FTPClient] 8 Sep 2015 09:37:17.393 : Caught exception Invalid REST argument. (code=554)
ERROR [FTPClient] 8 Sep 2015 09:37:17.394 : Caught exception
ERROR [FTPClient] 8 Sep 2015 09:37:17.394 : EnterpriseDT.Net.Ftp.FTPException: Invalid REST argument. (code=554)
ERROR [FTPClient] 8 Sep 2015 09:37:17.394 :    at EnterpriseDT.Net.Ftp.FTPControlSocket.ValidateReply(FTPReply reply, String[] expectedReplyCodes)
ERROR [FTPClient] 8 Sep 2015 09:37:17.394 :    at EnterpriseDT.Net.Ftp.FTPClient.InitGet(String remoteFile)
ERROR [FTPClient] 8 Sep 2015 09:37:17.394 :    at EnterpriseDT.Net.Ftp.FTPClient.GetBinary(String localPath, String remoteFile)
WARN [FTPConnection] 8 Sep 2015 09:37:17.398 : Could not get length of file 'C:\Projects\Badger Central\Source\Feature\0823\Factoring\Badger.Core.Services.Tests\bin\Debug\CCData090815090917.txt'
WARN [FTPConnection] 8 Sep 2015 09:37:17.398 : System.IO.FileNotFoundException: Could not find file 'C:\Projects\Badger Central\Source\Feature\0823\Factoring\Badger.Core.Services.Tests\bin\Debug\CCData090815090917.txt'.
WARN [FTPConnection] 8 Sep 2015 09:37:17.398 :    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
WARN [FTPConnection] 8 Sep 2015 09:37:17.398 :    at System.IO.FileInfo.get_Length()
WARN [FTPConnection] 8 Sep 2015 09:37:17.398 :    at EnterpriseDT.Net.Ftp.FTPConnection.GetLocalFileSize(String localPath)


The thing is I'm not trying to send a REST or get file size.  I just want to download the file, and they won't let us use our VAN to send or retrieve the files.
by (162k points)
This is bizarre. Is it possible that the file is being truncated on the server while you are downloading?

Have you tried using FIlezilla, and if so, was it successful?
by (120 points)
I was able to use the Windows command line FTP to do it, and it was successful (did not get any errors), so I am thinking the EnterpriseDT library is triggering something.
by (162k points)
Please post the Windows log - you can show the commands sent by typing "debug".
by (120 points)
ftp> debug
Debugging On .
ftp> cd /Outbox
---> CWD /Outbox
250 Requested file action okay, completed.
ftp> get CCDATA.TXT
---> PORT 192,168,1,105,214,145
200 PORT command successful.
---> RETR CCDATA.TXT
125 Data connection already open; transfer starting.
226 Closing data connection, ASCII transfer complete.
ftp: 574 bytes received in 0.00Seconds 574000.00Kbytes/sec.
by (162k points)
It occurred to me that it is probably barfing at the earlier "REST 0" command, which I only just noticed.

Is this edtFTPnet? Which version?
by (120 points)
It is edtFTPnet and it's version 2.2.2.0 according to the reference.
by (120 points)
Anyone??  I need to know what to do.
by (162k points)
Try the latest version, 2.2.3. It looks like it may be fixed in that version.
by (120 points)
Okay, just downloaded and will try it.
by (120 points)
It didn't help.  Here's the log from where the .NET ran (and I verified it was using the 2.2.3 version):

DEBUG [FTPConnection] 15 Sep 2015 14:04:37.612 : DownloadFile(C:\Projects\Badger Central\Source\Feature\0823\Factoring\Badger.Core.Services.Tests\bin\Debug\CCData091515020937.txt,CCDATA.TXT)
DEBUG [FTPControlSocket] 15 Sep 2015 14:04:37.616 : ---> REST 0
DEBUG [FTPControlSocket] 15 Sep 2015 14:04:37.663 : 350 Restarting at 0. Send STORE or RETRIEVE
DEBUG [FTPControlSocket] 15 Sep 2015 14:04:37.667 : ---> PASV
DEBUG [FTPControlSocket] 15 Sep 2015 14:04:37.718 : 227 Entering Passive Mode (206,212,89,52,34,199)
DEBUG [FTPControlSocket] 15 Sep 2015 14:04:37.718 : Server supplied address=206.212.89.52
DEBUG [FTPControlSocket] 15 Sep 2015 14:04:37.719 : Server supplied port=8903
DEBUG [FTPControlSocket] 15 Sep 2015 14:04:37.719 : autoPassiveIPSubstitution=True
DEBUG [FTPControlSocket] 15 Sep 2015 14:04:37.720 : remoteAddr=206.212.89.52
DEBUG [FTPControlSocket] 15 Sep 2015 14:04:37.720 : Substituting server supplied IP (206.212.89.52) with remote host IP (206.212.89.52)
DEBUG [FTPControlSocket] 15 Sep 2015 14:04:37.720 : NewPassiveDataSocket(206.212.89.52,8903)
INFO [BaseSocket] 15 Sep 2015 14:04:37.721 : Connecting to 206.212.89.52:8903 with timeout 120000 ms
DEBUG [BaseSocket] 15 Sep 2015 14:04:37.763 : Successfully connected to 206.212.89.52:8903
DEBUG [FTPControlSocket] 15 Sep 2015 14:04:37.763 : Connected
DEBUG [FTPControlSocket] 15 Sep 2015 14:04:37.764 : ---> RETR CCDATA.TXT
DEBUG [FTPControlSocket] 15 Sep 2015 14:04:37.964 : 554 Invalid REST argument.
DEBUG [FTPControlSocket] 15 Sep 2015 14:04:37.964 : Expected reply codes = [125,150] (strict=False)
ERROR [FTPClient] 15 Sep 2015 14:04:37.965 : Caught exception Invalid REST argument. (code=554)
ERROR [FTPClient] 15 Sep 2015 14:04:37.966 : Caught exception
ERROR [FTPClient] 15 Sep 2015 14:04:37.966 : EnterpriseDT.Net.Ftp.FTPException: Invalid REST argument. (code=554)
ERROR [FTPClient] 15 Sep 2015 14:04:37.966 :    at EnterpriseDT.Net.Ftp.FTPControlSocket.ValidateReply(FTPReply reply, String[] expectedReplyCodes)
ERROR [FTPClient] 15 Sep 2015 14:04:37.966 :    at EnterpriseDT.Net.Ftp.FTPClient.InitGet(String remoteFile)
ERROR [FTPClient] 15 Sep 2015 14:04:37.966 :    at EnterpriseDT.Net.Ftp.FTPClient.GetBinary(String localPath, String remoteFile)
WARN [FTPConnection] 15 Sep 2015 14:04:37.973 : Could not get length of file 'C:\Projects\Badger Central\Source\Feature\0823\Factoring\Badger.Core.Services.Tests\bin\Debug\CCData091515020937.txt'
WARN [FTPConnection] 15 Sep 2015 14:04:37.973 : System.IO.FileNotFoundException: Could not find file 'C:\Projects\Badger Central\Source\Feature\0823\Factoring\Badger.Core.Services.Tests\bin\Debug\CCData091515020937.txt'.
WARN [FTPConnection] 15 Sep 2015 14:04:37.973 :    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
WARN [FTPConnection] 15 Sep 2015 14:04:37.973 :    at System.IO.FileInfo.get_Length()
WARN [FTPConnection] 15 Sep 2015 14:04:37.973 :    at EnterpriseDT.Net.Ftp.FTPConnection.GetLocalFileSize(String localPath, Boolean logExceptionAsWarn)
by (162k points)
Ok, I'll take a look tomorrow - I'm pretty sure we've fixed this so it may not be out in edtFTPnet.
by (162k points)
I've got a new build for you to try - please email support at enterprisedt dot com for a link.

Categories

...