Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
+1 vote
3.1k views
in .NET FTP by (130 points)
edited by
I am trying to upload files in a winforms application (c# dotnet 4.6)

My code is very simple :

using (FTPConnection ftpConnection = new FTPConnection())
{
                        ftpConnection.ServerAddress = _ftpDefinition.Host;
                        ftpConnection.ServerPort = _ftpDefinition.Port;
                        ftpConnection.UserName = _ftpDefinition.UserName;
                        ftpConnection.Password = _ftpDefinition.PassWord;

                        FTPConnection.LogLevel = EnterpriseDT.Util.Debug.LogLevel.All;
                        FTPConnection.LogFile = @"C:\test\ftplog\ftp_log.txt";
 
                        ftpConnection.Connect();
                        ftpConnection.ChangeWorkingDirectory(remoteDir);
                        ftpConnection.UploadFile(localDir + fileName, fileName);
                        ftpConnection.Close();
}

From what I read in the logfile it looks like if the file has been transferred.
But if I look at the folder using an ftpclient (filezilla and Total Commander) then the file is not there.

Both FTP Clients cannot see it.
What can cause this and how to fix it ?

 

The entire log is here :

DEBUG [FTPConnection] 3 mei 2017 10:14:24.601 : Set LocalDirectory='C:\Development\Palm\gttXMLImportExportService\gttXMLImportExportService\gttXMLImportExportService\bin\Debug'
DEBUG [FTPClient] 3 mei 2017 10:14:24.601 : Connecting to ftp.dinetxs.com:10021
DEBUG [HostNameResolver] 3 mei 2017 10:14:24.601 : Resolving ftp.dinetxs.com
DEBUG [HostNameResolver] 3 mei 2017 10:14:24.611 : ftp.dinetxs.com resolved to 212.140.163.240
INFO [BaseSocket] 3 mei 2017 10:14:24.611 : Connecting to 212.140.163.240:10021 with timeout 120000 ms
DEBUG [BaseSocket] 3 mei 2017 10:14:24.661 : Successfully connected to 212.140.163.240:10021
DEBUG [FTPControlSocket] 3 mei 2017 10:14:24.661 : Setting socket timeout=120000
INFO [FTPControlSocket] 3 mei 2017 10:14:24.661 : Command encoding=System.Text.SBCSCodePageEncoding
DEBUG [FTPControlSocket] 3 mei 2017 10:14:24.661 : StrictReturnCodes=False
DEBUG [FTPControlSocket] 3 mei 2017 10:14:24.711 : 220 Welcome to the DINET FTP Server.
DEBUG [FTPConnection] 3 mei 2017 10:14:24.711 : Connected to ftp.dinetxs.com (instance=0)
DEBUG [FTPControlSocket] 3 mei 2017 10:14:24.711 : ---> USER OMSFTP201
DEBUG [FTPControlSocket] 3 mei 2017 10:14:24.761 : 331 Now please specify password.
DEBUG [FTPControlSocket] 3 mei 2017 10:14:24.761 : ---> PASS ********
DEBUG [FTPControlSocket] 3 mei 2017 10:14:24.891 : 230 Welcome to the EPIC FTP service.
DEBUG [FTPConnection] 3 mei 2017 10:14:24.891 : Successfully logged in
INFO [FTPConnection] 3 mei 2017 10:14:24.891 : Auto FEAT disabled
DEBUG [FTPControlSocket] 3 mei 2017 10:14:24.891 : ---> TYPE I
DEBUG [FTPControlSocket] 3 mei 2017 10:14:24.941 : 200 Ok.
DEBUG [FTPControlSocket] 3 mei 2017 10:14:24.941 : ---> PWD
DEBUG [FTPControlSocket] 3 mei 2017 10:14:24.991 : 257 "/"
DEBUG [FTPConnection] 3 mei 2017 10:14:26.210 : ChangeWorkingDirectory('/In')
DEBUG [FTPControlSocket] 3 mei 2017 10:14:26.210 : ---> CWD /In
DEBUG [FTPControlSocket] 3 mei 2017 10:14:26.260 : 250 Current directory is now /In.
DEBUG [FTPControlSocket] 3 mei 2017 10:14:26.260 : ---> PWD
DEBUG [FTPControlSocket] 3 mei 2017 10:14:26.310 : 257 "/In"
DEBUG [FTPConnection] 3 mei 2017 10:14:28.441 : UploadFile(\\TS2012R2\PalmDocuments\EDI\Ford\GttToFord\temp\GTT_20170503_33078_3.EDI,GTT_20170503_33078_3.EDI,False)
DEBUG [FTPConnection] 3 mei 2017 10:14:28.441 : Cancel resume
DEBUG [FTPControlSocket] 3 mei 2017 10:14:28.441 : ---> REST 0
DEBUG [FTPControlSocket] 3 mei 2017 10:14:28.491 : 502 This command is not implemented on this server.
DEBUG [FTPControlSocket] 3 mei 2017 10:14:28.491 : Expected reply codes = [350] (strict=False)
DEBUG [FTPClient] 3 mei 2017 10:14:28.491 : REST failed which is ok (This command is not implemented on this server. (code=502))
DEBUG [FTPControlSocket] 3 mei 2017 10:14:28.491 : ---> PASV
DEBUG [FTPControlSocket] 3 mei 2017 10:14:28.571 : 227 (212,140,163,240,117,130)
DEBUG [FTPControlSocket] 3 mei 2017 10:14:28.571 : Server supplied address=212.140.163.240
DEBUG [FTPControlSocket] 3 mei 2017 10:14:28.571 : Server supplied port=30082
DEBUG [FTPControlSocket] 3 mei 2017 10:14:28.571 : autoPassiveIPSubstitution=True
DEBUG [FTPControlSocket] 3 mei 2017 10:14:28.571 : remoteAddr=212.140.163.240
DEBUG [FTPControlSocket] 3 mei 2017 10:14:28.571 : Substituting server supplied IP (212.140.163.240) with remote host IP (212.140.163.240)
DEBUG [FTPControlSocket] 3 mei 2017 10:14:28.571 : NewPassiveDataSocket(212.140.163.240,30082)
INFO [BaseSocket] 3 mei 2017 10:14:28.571 : Connecting to 212.140.163.240:30082 with timeout 120000 ms
DEBUG [BaseSocket] 3 mei 2017 10:14:28.621 : Successfully connected to 212.140.163.240:30082
DEBUG [FTPControlSocket] 3 mei 2017 10:14:28.621 : Connected
DEBUG [FTPControlSocket] 3 mei 2017 10:14:28.621 : ---> STOR GTT_20170503_33078_3.EDI
DEBUG [FTPControlSocket] 3 mei 2017 10:14:28.701 : 125 Data connection connected, starting transfer.
DEBUG [FTPClient] 3 mei 2017 10:14:28.701 : Closing source stream
DEBUG [FTPClient] 3 mei 2017 10:14:28.701 : Transferred 2304 bytes to remote host
DEBUG [FTPControlSocket] 3 mei 2017 10:14:28.801 : 226 Ok.
DEBUG [FTPConnection] 3 mei 2017 10:14:29.650 : Closing connection (instance=0)
DEBUG [FTPFileFactory] 3 mei 2017 10:14:29.650 : Defaulting to Unix parsing
DEBUG [FTPControlSocket] 3 mei 2017 10:14:29.650 : ---> QUIT
DEBUG [FTPControlSocket] 3 mei 2017 10:14:29.700 : 221 Service is closing.
by (162k points)
Filezilla does cache directory listings, so make sure you close it and restart. Also ensure the file is going to the location you think it is.
by (130 points)
I do close the connection in filezilla before retrieving a list so that should not be the problem. If I drag the file from explorer to filezilla than I can see that file, but not the file that is uploaded using this library. As for the location, I do see the correct changedir in the log file. I will upload the entire log.
by (130 points)
I also tried with actually closing and restarting filezilla, still no changes. The file is still not there or not visible but the log keeps saying it has transferred the file.
by (130 points)
I also tried with Total Commander and the same result. The log says the file is transfered, but both Total Commander and FileZilla cannot see it

1 Answer

0 votes
by (51.6k points)
I'm sorry, but this is clearly a server issue.  Please contact the vendor of the server software.
by (130 points)
I"m sorry but this is NO server issue. If it was a server issue than files I upload using FileZilla or TotalCommander would also be not visible. And that is not the case.

It is clearly an issue of the uploading library in my opinion.
by (51.6k points)
I'm sorry.  I didn't mean to ignore your comment; it just got lost in my inbox.

Yes, I agree that it's strange that it works in FileZilla but not with edtFTPnet/PRO.  I missed that bit of information previously.

Have you got access to the server logs?  If so then it would be interesting to see if you can see the file being uploaded successfully, and if anything happens to it afterwards.
by (130 points)
Unfortunate I do not have access to the logs of that server.
All I can do is use the webinterface of that company and retrieve a list of uploaded/downloaded files. In that list the files I have uploaded are present. That is how I know that the files did indeed uploaded. I asked the same question to this  company but have received no answer yet, except that this is a low priority ticket.
So I guess there is not much that we can do ?
by (2.7k points)
Have you tried uploading using the command-line FTP client, ftp.exe?  After you upload the file, list the directory.  It will be interesting to see if the file is there.
by (130 points)
No, but I did tried listing the directory using the command-line FTP client and it always resulted in a "hanging" command-line FTP client. I think it must be a combination of some exotic server setting and ftp client but without assistance from the company that manages the ftp server this will be difficult to solve.
by (2.7k points)
Yeah, I think you might have to wait for support to get back to you.
by (140 points)
I have the same problem in FTP Client. I tried to write log detail, and I found the 'uploadfile' method of FTP client that it sometimes will send file to root directory because the method will change directory to root directory before upload file,
so I can't see the file in correct directory.
Please to check the action of the 'uploadfile()' method. Why does it sometimes change directory to root directory before?
=================
My program is as follow:
    //??????????remote??
                            MainFTP.objWriteFileLog.DebugWrite("DO_FTP.doSend_FTP()", $"6_ChangeWorkingDirectory????Server??? = {objFtp.ServerDirectory}?MainFTP.vFTP_PARA[16] = {MainFTP.vFTP_PARA[16]}", MainFTP.sMsgGUID);
                            objFtp.ChangeWorkingDirectory(MainFTP.vFTP_PARA[16]);
                            MainFTP.objWriteFileLog.DebugWrite("DO_FTP.doSend_FTP()", $"6_ChangeWorkingDirectory????Server??? = {objFtp.ServerDirectory}", MainFTP.sMsgGUID);

 MainFTP.objWriteFileLog.DebugWrite("DO_FTP.doSend_FTP()", $"7_UploadFile??Server???:{objFtp.ServerDirectory}?UploadFile:MainFTP.sBufSendName={MainFTP.sBufSendName.ToString()}", MainFTP.sMsgGUID);                                 
                                    objFtp.UploadFile(sMainFilePath + MainFTP.sBufSendName.ToString(), MainFTP.sBufSendName.ToString());                            
                                    MainFTP.objWriteFileLog.DebugWrite("DO_FTP.doSend_FTP()", $"7_UploadFile??Server???:{objFtp.ServerDirectory}", MainFTP.sMsgGUID);

================================ The log of uploadfile()  action ======
05:15:36.388||[GUID=SFTPConsole_TP_MCB_AP2AP_SFTP_bad4bcb2-763f-42ba-8bee-7722fd64a4c5]||[DO_FTP.doSend_FTP()]||[DEBUG]||0_Call doConnection()? Server ??(directory)? = /dw/ftpdata/ftpucc1
05:15:36.388||[GUID=SFTPConsole_TP_MCB_AP2AP_SFTP_bad4bcb2-763f-42ba-8bee-7722fd64a4c5]||[DO_FTP.doSend_FTP()]||[DEBUG]||1_Server??(directory)? = /dw/ftpdata/ftpucc1
05:15:36.388||[GUID=SFTPConsole_TP_MCB_AP2AP_SFTP_bad4bcb2-763f-42ba-8bee-7722fd64a4c5]||[doSend_FTP]||[DEBUG]||
2_MainFTP.vFTP_PARA[16] = /dw/ftpdata/ftpucc1/Upload/  ===> this is destination dir
05:15:36.388||[GUID=SFTPConsole_TP_MCB_AP2AP_SFTP_bad4bcb2-763f-42ba-8bee-7722fd64a4c5]||[DO_FTP.doSend_FTP()]||[DEBUG]||
6_ChangeWorkingDirectory???(before change)?Server??(directory is )? = /dw/ftpdata/ftpucc1
?MainFTP.vFTP_PARA[16] = /dw/ftpdata/ftpucc1/Upload/ ===> the destination dir

05:15:36.404||[GUID=SFTPConsole_TP_MCB_AP2AP_SFTP_bad4bcb2-763f-42ba-8bee-7722fd64a4c5]||[Do_FTP.Ftp_ServerDirectoryChanging()]||[INFO]||Ftp_ServerDirectoryChanging():EnterpriseDT.Net.Ftp.FTPDirectoryEventArgs
05:15:36.404||[GUID=SFTPConsole_TP_MCB_AP2AP_SFTP_bad4bcb2-763f-42ba-8bee-7722fd64a4c5]||[DO_FTP.doSend_FTP()]||[DEBUG]||
6_ChangeWorkingDirectory???(after change directory)?Server??(directory)? = /dw/ftpdata/ftpucc1/Upload  ====> destinataion dir is change to correct directory

05:15:36.404||[GUID=SFTPConsole_TP_MCB_AP2AP_SFTP_bad4bcb2-763f-42ba-8bee-7722fd64a4c5]||[DO_FTP.doSend_FTP()]||[DEBUG]||

7_UploadFile?(before uploadfile)?Server???(directory is ):/dw/ftpdata/ftpucc1/Upload?
UploadFile:MainFTP.sBufSendName=ACRI.01700000.2018011601

05:15:36.404||[GUID=SFTPConsole_TP_MCB_AP2AP_SFTP_bad4bcb2-763f-42ba-8bee-7722fd64a4c5]||[Do_FTP.Ftp_ServerDirectoryChanging()]||[INFO]
====> I don't know why it doing chang direcotory.
||Ftp_ServerDirectoryChanging():EnterpriseDT.Net.Ftp.FTPDirectoryEventArgs

05:15:36.482||[GUID=SFTPConsole_TP_MCB_AP2AP_SFTP_bad4bcb2-763f-42ba-8bee-7722fd64a4c5]||[Do_FTP.Ftp_Uploaded()]||[INFO]|
|Ftp_Uploaded End() EnterpriseDT.Net.Ftp.FTPFileTransferEventArgs
===> upload file is afterr change directory.

05:15:36.482||[GUID=SFTPConsole_TP_MCB_AP2AP_SFTP_bad4bcb2-763f-42ba-8bee-7722fd64a4c5]||[DO_FTP.doSend_FTP()]||[DEBUG]||7_UploadFile?(after)?Server???(directory is ) :/dw/ftpdata/ftpucc1  ===> it be chage to root directory.

05:15:36.576||[GUID=SFTPConsole_TP_MCB_AP2AP_SFTP_bad4bcb2-763f-42ba-8bee-7722fd64a4c5]||[Do_FTP.Ftp_Closed()]||[INFO]||EnterpriseDT.Net.Ftp.FTPConnectionEventArgs
==============================
Logs of edtFTP component as follow

DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.388 :  ---> TYPE I
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.388 :  200 Type set to I.
DEBUG [ExFTPConnection] 16 ?? 2018 05:15:36.388 : FTPConnection.1 Starting KeepAlive thread with period 30s
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.388 :  ---> PWD
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.388 :  257 "/dw/ftpdata/ftpucc1" is current directory.
DEBUG [FTPConnection] 16 ?? 2018 05:15:36.388 :  Home directory is '/dw/ftpdata/ftpucc1'
DEBUG [FTPTaskProcessor] 16 ?? 2018 05:15:36.388 :  BeginTask: [ID=1] GetFileInfos()
DEBUG [FTPTaskProcessor] 16 ?? 2018 05:15:36.388 :  Invoking task on connection 0: [ID=1] GetFileInfos()
DEBUG [FTPConnection] 16 ?? 2018 05:15:36.388 :  DirectoryExists(/dw/ftpdata/ftpucc1/Upload/)
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.388 :  ---> CWD /dw/ftpdata/ftpucc1/Upload/
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.388 :  250 CWD command successful.
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.388 :  ---> CWD /dw/ftpdata/ftpucc1
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.388 :  250 CWD command successful.
DEBUG [FTPConnection] 16 ?? 2018 05:15:36.404 :  ChangeWorkingDirectory('/dw/ftpdata/ftpucc1/Upload/')
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.404 :  ---> CWD /dw/ftpdata/ftpucc1/Upload/
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.404 :  250 CWD command successful.
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.404 :  ---> PWD
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.404 :  257 "/dw/ftpdata/ftpucc1/Upload" is current directory.

=========== after log is not my program doing =============
DEBUG [FTPConnection] 16 ?? 2018 05:15:36.404 : FTPConnection.1 ChangeWorkingDirectory('/dw/ftpdata/ftpucc1')
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.404 : FTPConnection.1 ---> CWD /dw/ftpdata/ftpucc1
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.404 : FTPConnection.1 250 CWD command successful.
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.404 : FTPConnection.1 ---> PWD
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.404 : FTPConnection.1 257 "/dw/ftpdata/ftpucc1" is current directory.
=================== before log is not my program doing =============

DEBUG [ExFTPConnection] 16 ?? 2018 05:15:36.404 :  Attempt 1: ACRI.01700000.2018011601 Overwrite
DEBUG [FTPTaskProcessor] 16 ?? 2018 05:15:36.404 : FTPConnection.1 Running task on connection 0: [ID=1] GetFileInfos()
by (2.7k points)
Can you please post _only_ the logging of the edtFTP component, including the STOR (i.e. upload) command?

Please also post the code that calls the component.
by (140 points)
Log 2
=========================================
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.404 :  remoteAddr=10.2.99.18
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.404 :  Substituting server supplied IP (10.2.99.18) with remote host IP (10.2.99.18)
DEBUG [SecureSocket] 16 ?? 2018 05:15:36.419 :  ChangeSecurityProtocol: None
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.419 :  SetSocketTimeout: 120000
DEBUG [HostNameResolver] 16 ?? 2018 05:15:36.419 :  Resolving 10.2.99.18
DEBUG [HostNameResolver] 16 ?? 2018 05:15:36.419 :  10.2.99.18 resolved to 10.2.99.18
DEBUG [ExFTPControlSocket] 16 ?? 2018 05:15:36.419 :  Connecting directly to ftp-server 10.2.99.18:55031
INFO [SSLFTPSocket] 16 ?? 2018 05:15:36.419 :  Connecting to 10.2.99.18:55031 with timeout 120000 ms
DEBUG [SSLFTPSocket] 16 ?? 2018 05:15:36.419 :  Successfully connected to 10.2.99.18:55031
DEBUG [ExFTPPassiveDataSocket] 16 ?? 2018 05:15:36.419 :  Created passive data-socket: ProxyConnector=
DEBUG [SSLFTPPassiveDataSocket] 16 ?? 2018 05:15:36.419 :  Created passive data-socket: Protocol=None, CompatibilityFlags=Standard, UseSSLClosure=True, WaitOnClose=True
DEBUG [FTPDataSocket] 16 ?? 2018 05:15:36.419 :  SetSocketTimeout: 120000
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.419 :  ---> STOR ACRI.01700000.2018011601
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.419 :  150 Opening data connection for ACRI.01700000.2018011601.
DEBUG [FTPClient] 16 ?? 2018 05:15:36.419 :  Closing source stream
DEBUG [SecureSocket] 16 ?? 2018 05:15:36.419 :  Shutdown(Both)
DEBUG [SSLFTPPassiveDataSocket] 16 ?? 2018 05:15:36.419 :  Attempt to close unconnected passive data-channel.
DEBUG [FTPClient] 16 ?? 2018 05:15:36.419 :  Transferred 420 bytes to remote host
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.482 :  226 Transfer complete.
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.482 :  ---> SIZE ACRI.01700000.2018011601
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.482 :  213 420
DEBUG [FTPConnection] 16 ?? 2018 05:15:36.482 :  GetLastWriteTime(ACRI.01700000.2018011601)
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.482 :  ---> MDTM ACRI.01700000.2018011601
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.482 :  213 20180115211536
DEBUG [FTPTaskProcessor] 16 ?? 2018 05:15:36.482 :  Purging task queue
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.498 : FTPConnection.1 ---> SYST
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.498 : FTPConnection.1 215 UNIX Type: L8 Version: BSD-44
DEBUG [FTPConnection] 16 ?? 2018 05:15:36.498 :  Closing connection [instance=0,abrupt=False]
DEBUG [FTPFileFactory] 16 ?? 2018 05:15:36.498 : FTPConnection.1 Selected UNIX parser
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.498 : FTPConnection.1 ---> PWD
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.498 : FTPConnection.1 257 "/dw/ftpdata/ftpucc1" is current directory.
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.498 : FTPConnection.1 ---> PASV
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.498 : FTPConnection.1 227 Entering Passive Mode (10,2,99,18,214,248)
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.498 : FTPConnection.1 Server supplied address=10.2.99.18
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.498 : FTPConnection.1 Server supplied port=55032
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.498 : FTPConnection.1 autoPassiveIPSubstitution=True
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.498 : FTPConnection.1 remoteAddr=10.2.99.18
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.498 : FTPConnection.1 Substituting server supplied IP (10.2.99.18) with remote host IP (10.2.99.18)
DEBUG [SecureSocket] 16 ?? 2018 05:15:36.498 : FTPConnection.1 ChangeSecurityProtocol: None
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.498 : FTPConnection.1 SetSocketTimeout: 120000
DEBUG [HostNameResolver] 16 ?? 2018 05:15:36.498 : FTPConnection.1 Resolving 10.2.99.18
DEBUG [HostNameResolver] 16 ?? 2018 05:15:36.498 : FTPConnection.1 10.2.99.18 resolved to 10.2.99.18
DEBUG [ExFTPControlSocket] 16 ?? 2018 05:15:36.498 : FTPConnection.1 Connecting directly to ftp-server 10.2.99.18:55032
INFO [SSLFTPSocket] 16 ?? 2018 05:15:36.498 : FTPConnection.1 Connecting to 10.2.99.18:55032 with timeout 120000 ms
DEBUG [SSLFTPSocket] 16 ?? 2018 05:15:36.498 : FTPConnection.1 Successfully connected to 10.2.99.18:55032
DEBUG [ExFTPPassiveDataSocket] 16 ?? 2018 05:15:36.498 : FTPConnection.1 Created passive data-socket: ProxyConnector=
DEBUG [SSLFTPPassiveDataSocket] 16 ?? 2018 05:15:36.498 : FTPConnection.1 Created passive data-socket: Protocol=None, CompatibilityFlags=Standard, UseSSLClosure=True, WaitOnClose=True
DEBUG [FTPDataSocket] 16 ?? 2018 05:15:36.498 : FTPConnection.1 SetSocketTimeout: 120000
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.498 : FTPConnection.1 ---> LIST
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.498 : FTPConnection.1 150 Opening data connection for /bin/ls.
DEBUG [FTPClient] 16 ?? 2018 05:15:36.498 : FTPConnection.1 -->total 96528
--- delete some log because data more than 8000 character
DEBUG [SecureSocket] 16 ?? 2018 05:15:36.513 : FTPConnection.1 Shutdown(Both)
DEBUG [SSLFTPPassiveDataSocket] 16 ?? 2018 05:15:36.513 : FTPConnection.1 Attempt to close unconnected passive data-channel.
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.560 : FTPConnection.1 226 Transfer complete.
DEBUG [FTPClient] 16 ?? 2018 05:15:36.560 : FTPConnection.1 Found 97 listing lines
DEBUG [FTPFileFactory] 16 ?? 2018 05:15:36.560 : FTPConnection.1 Parse() called using culture: Invariant Language (Invariant Country)
DEBUG [FTPFileFactory] 16 ?? 2018 05:15:36.560 : FTPConnection.1 Confirmed format UNIX
DEBUG [FTPFileFactory] 16 ?? 2018 05:15:36.560 :  Defaulting to Unix parsing
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.560 :  ---> QUIT
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.560 :  221 Goodbye.
DEBUG [FTPTaskProcessor] 16 ?? 2018 05:15:36.576 : FTPConnection.1 Next task: True, False, True, False
DEBUG [FTPTaskProcessor] 16 ?? 2018 05:15:36.576 : FTPConnection.1 Task queue size = 0
DEBUG [FTPTaskProcessor] 16 ?? 2018 05:15:36.576 : FTPConnection.1 No next task found
DEBUG [SecureSocket] 16 ?? 2018 05:15:36.576 :  Shutdown(Both)
by (140 points)
edited by
Log1

---delete due to characters more than 8000
DEBUG [ExFTPControlSocket] 16 ?? 2018 05:15:36.279 :  Connecting directly to ftp-server 10.2.99.18:21
INFO [SSLFTPSocket] 16 ?? 2018 05:15:36.279 :  Connecting to 10.2.99.18:21 with timeout 120000 ms
DEBUG [SSLFTPSocket] 16 ?? 2018 05:15:36.279 :  Successfully connected to 10.2.99.18:21
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.279 :  Setting socket timeout=120000
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.279 :  SetSocketTimeout: 120000
INFO [FTPControlSocket] 16 ?? 2018 05:15:36.294 :  Command encoding=System.Text.DBCSCodePageEncoding
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.294 :  220 DW FTP server (Version 4.2 Tue May 6 10:48:36 CDT 2014) ready.
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.294 :  ---> USER ftpucc1
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.294 :  331 Password required for ftpucc1.
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.294 :  ---> PASS ********
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.310 :  230-Last unsuccessful login: Thu Nov 23 17:38:55 TAIST 2017 on ftp from ::ffff:10.2.9.2
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.373 :  230-Last login: Tue Jan 16 05:10:38 TAIST 2018 on ftp from ::ffff:192.168.3.63
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.373 :  230 User ftpucc1 logged in.
DEBUG [FTPConnection] 16 ?? 2018 05:15:36.373 :  Successfully logged in
INFO [FTPConnection] 16 ?? 2018 05:15:36.373 :  Auto FEAT disabled
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.388 :  ---> TYPE I
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.388 :  200 Type set to I.
DEBUG [ExFTPConnection] 16 ?? 2018 05:15:36.388 : FTPConnection.1 Starting KeepAlive thread with period 30s
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.388 :  ---> PWD
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.388 :  257 "/dw/ftpdata/ftpucc1" is current directory.
DEBUG [FTPConnection] 16 ?? 2018 05:15:36.388 :  Home directory is '/dw/ftpdata/ftpucc1'
DEBUG [FTPTaskProcessor] 16 ?? 2018 05:15:36.388 :  BeginTask: [ID=1] GetFileInfos()
DEBUG [FTPTaskProcessor] 16 ?? 2018 05:15:36.388 :  Invoking task on connection 0: [ID=1] GetFileInfos()
DEBUG [FTPConnection] 16 ?? 2018 05:15:36.388 :  DirectoryExists(/dw/ftpdata/ftpucc1/Upload/)
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.388 :  ---> CWD /dw/ftpdata/ftpucc1/Upload/
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.388 :  250 CWD command successful.
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.388 :  ---> CWD /dw/ftpdata/ftpucc1
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.388 :  250 CWD command successful.
============  step 6 start
DEBUG [FTPConnection] 16 ?? 2018 05:15:36.404 :  ChangeWorkingDirectory('/dw/ftpdata/ftpucc1/Upload/')
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.404 :  ---> CWD /dw/ftpdata/ftpucc1/Upload/
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.404 :  250 CWD command successful.
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.404 :  ---> PWD
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.404 :  257 "/dw/ftpdata/ftpucc1/Upload" is current directory.
================Step 6 End ==============

===============Step7 Start ==== Just call uploadfile() =====================

DEBUG [FTPConnection] 16 ?? 2018 05:15:36.404 : FTPConnection.1 ChangeWorkingDirectory('/dw/ftpdata/ftpucc1')   ==========> Question 1 , This ChangeWorkingDirectory action is not called by my program.

DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.404 : FTPConnection.1 ---> CWD /dw/ftpdata/ftpucc1
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.404 : FTPConnection.1 250 CWD command successful.
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.404 : FTPConnection.1 ---> PWD
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.404 : FTPConnection.1 257 "/dw/ftpdata/ftpucc1" is current directory.
DEBUG [ExFTPConnection] 16 ?? 2018 05:15:36.404 :  Attempt 1: ACRI.01700000.2018011601 Overwrite
DEBUG [FTPTaskProcessor] 16 ?? 2018 05:15:36.404 : FTPConnection.1 Running task on connection 0: [ID=1] GetFileInfos()
DEBUG [FTPConnection] 16 ?? 2018 05:15:36.404 :  UploadFile(D:\ftp\ap2ap\megacard\PAY_SEND\SENDING\ACRI.01700000.2018011601,ACRI.01700000.2018011601,Overwrite)

====End Step 7 uploadfile() End =====================

DEBUG [FTPConnection] 16 ?? 2018 05:15:36.404 : FTPConnection.1 GetFileInfos('')
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.404 :  ---> PASV
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.404 :  227 Entering Passive Mode (10,2,99,18,214,247)
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.404 :  Server supplied address=10.2.99.18
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.404 :  Server supplied port=55031
DEBUG [FTPControlSocket] 16 ?? 2018 05:15:36.404 :  autoPassiveIPSubstitution=True
by (2.7k points)
I've looked at your log and it's clear that it's changing to the directory, /dw/ftpdata/ftpucc1, just before it uploads the file.  It's not clear why it's doing this though.  Can you please paste the code that calls our component into your reply?
by (140 points)
objFtp ==> is edtFTP component object

My program is as follow:
     //Check changedirectory to correct directory
             MainFTP.objWriteFileLog.DebugWrite("step 6_ChangeWorkingDirectory Before?Server??? = {objFtp.ServerDirectory}?MainFTP.vFTP_PARA[16] = {MainFTP.vFTP_PARA[16]}", MainFTP.sMsgGUID);
              objFtp.ChangeWorkingDirectory(MainFTP.vFTP_PARA[16]); ==> only change to MainFTP.vFTP_PARA[16] = /dw/ftpdata/ftpucc1/upload  

                             MainFTP.objWriteFileLog.DebugWrite("DO_FTP.doSend_FTP()", $"step 6_ChangeWorkingDirectory AFTER?Server??? = {objFtp.ServerDirectory}", MainFTP.sMsgGUID);

  MainFTP.objWriteFileLog.DebugWrite("DO_FTP.doSend_FTP()", $"step 7_UploadFile Before?Server???:{objFtp.ServerDirectory}?UploadFile:MainFTP.sBufSendName={MainFTP.sBufSendName.ToString()}", MainFTP.sMsgGUID);                                 
                                     objFtp.UploadFile(sMainFilePath + MainFTP.sBufSendName.ToString(), MainFTP.sBufSendName.ToString());                            
                                     MainFTP.objWriteFileLog.DebugWrite("DO_FTP.doSend_FTP()", $"7_UploadFile AFTER?Server???:{objFtp.ServerDirectory}", MainFTP.sMsgGUID);

=================

detail as up message (you can check the program and my log, edtFTP log), and then you will see step 6. ==> step 7 ; 7 only doing uploadfile() , and 6 only doing change to [/dw/ftpdata/ftpucc1/upload])

and then, you can check edtftp log and  my log of program , you will see the "uploadfile()"  method do two action, first is change to root folder, and second step is upload file.

so your should check the action of "uploadfile()" method.
by (2.7k points)
I really need to see all of the code that's using our component, to be able to tell what's going on.  When I have this sort of problem within a large application, I often create a small stand-alone test project that isolates the problem that I'm trying to solve, so if I were you I would create a test project that replicates the problem.  It usually only takes a few minutes to do and doing it often makes the problem quite obvious.  If it doesn't reveal the problem then I would be happy to try it out, provided you have a current support agreement.
by (140 points)
My program is not very large, and it is a stand-alone. It is a console for doing one receive or send action. I have another program for checking all tasks those need to send or receive, and then the program will call the console to do one task(This console just using your component). The console have more than one in the same time because we have more files to send different FTP Server.

The problem  is not happen erery times, so I am difficult to get it question by once connection.

The send method is as follow:

other program call
Do_FTP.doSend_FTP();

        /// <summary>
        ///  Do_FTP ???
        /// </summary>
        /// <param name="sServer">FTP???(IP)</param>
        /// <param name="sLoginName">????</param>
        /// <param name="sPort">PORT</param>
        /// <param name="sPwd">??</param>
        public Do_FTP()
        {
            try
            {
                objFtp = new SecureFTPConnection();
                objFtp.LicenseKey = "041-XXXXXXXXX";
                objFtp.LicenseOwner = "MegXXXXXXXXX";
            }
            catch (Exception ex)
            {
                objChgStrFmt.wriMsgToConsole(-1, "Do_FTP?????????:" + ex.Message, "E", "");
                sErrMsg="Do_FTP?????????:" + ex.Message;
            }
        }


  /// <summary>
        /// ????????(??)
        /// </summary>
        /// <returns></returns>
      
  /// <summary>
        /// ????????(??)
        /// </summary>
        /// <returns></returns>
        public int doSend_FTP()
        {
            int iResult = 0; //0:??? -1:??
            bool flag = true;
            MainFTP.sNowMethodName = "doSend_FTP";
            StringBuilder objSBufScrData = new StringBuilder("");
            string sMainFilePath = "";
            string sMainChkFilePath = ""; //H-098-0063

            try
            {

                //????/?????
                this.iReTryNum = int.Parse(MainFTP.vFTP_PARA[25]);  //?????
                this.iCanReTryNum = int.Parse(MainFTP.vFTP_PARA[24]);  //??????


                #region 1.??FTP Server  --> ???????

                if (doConnection() == true)
                {                    #region 2.????????


                    //?????
                    iResult = MainFTP.vFTP_PARA[14].LastIndexOf("\\") + 1;
                    sMainFilePath = MainFTP.vFTP_PARA[14].Substring(0, iResult);


                    if (flag == true)
                    {
                      
                       
                            objFtp.ChangeWorkingDirectory(MainFTP.vFTP_PARA[16]);     
                            objFtp.UploadFile(sMainFilePath + MainFTP.sBufSendName.ToString(), MainFTP.sBufSendName.ToString());                               

                        iResult = 0;  //????????

                    }  //End -if

                    #endregion

                    #region 3.??????
                    if (flag == true)
                    {
                        flag = doCloseConnect();
                    }
                    else
                    {
                        doCloseConnect();
                    }
                    #endregion

                }
                else
                {
                    iResult = -1;  //??????
                }

                #endregion

                if (flag == false)
                {
                    iResult = -1;  //??????
                }

            }
            catch (Exception ex)
            {             
                  iResult = -1;
            }
            finally
            {
                isLoginedOK = 0; //???0
            }
            return iResult;
        }


 /// <summary>
        /// ??FTP????
        /// </summary>
        private bool doConnection()
        {
            bool flag = false;
            try
            {
                if (objFtp.IsConnected == false)
                {
                    init_edtFTPnetPro(MainFTP.sFTP_IP, MainFTP.sFTP_IP, int.Parse(MainFTP.sFTP_PORT));
                    objFtp.UserName = MainFTP.sUSER_NAME;
                    objFtp.Password = MainFTP.sPWD;
                    if (MainFTP.sFTP_TRANSFER_TYPE.Equals("A"))
                        objFtp.TransferType = FTPTransferType.ASCII; //?ascii????,??(???)?binary??
                    objFtp.Connect();
                }
                if (objFtp.IsConnected == true)
                {       
                    objFtp.BeginGetFileInfos(null,null); //???????/??
                    flag = true;
                }
                else {
                    flag = false;
                }
            }
            catch (Exception ex)
            {
                objChgStrFmt.wriMsgToConsole(-1, "Do_FTP.doConnection()????:" + ex.Message, "W", "");
                sErrMsg="Do_FTP.doConnection()????:" + ex.Message;
                flag = false;
            }
            return flag;
        }
=====================
I will change logLevel to ALL for get more information.

  SecureFTPConnection.LogLevel = LogLevel.All;

Thanks!
by (2.7k points)
You're mixing synchronous and asynchronous methods, which is not advisable since you have no control of which sequence operations are carried in.

In doSend_FTP() you call doConnection().  In doConnection() you invoke BeginGetFileInfos and then the method returns.  doSend_FTP() then goes on to call ChangeWorkingDirectory() and then UploadFile().  Since BeginGetFileInfos() instructs SecureFTPConnection to get a file listing on a worker thread, this operation will happen concurrently with ChangeWorkingDirectory() and UploadFile(), which could cause the behaviour that you're seeing.

I don't know why you're calling BeginGetFileInfos() since you don't appear to be using the listing for anything, but if you do need to do it then you should use the synchronous version, i.e. GetFileInfos().
by (140 points)
Maybe BeginGetFileInfos() in doConnection() is a question because I don't understand why the console read root folder sometimes, and that is not an instruct from my program.

I will change the console program for deleting objFtp.BeginGetFileInfos() method in
doConnection() method, and then care it.

Does happen change to root directory due to the same login user connection to FTP Server in different the console processes or different clients?

Thanks!!

Categories

...