0 votes
by (310 points)
edited

I have a problem at one of our client installations. We can login in to the ftp site using your .connect, .login and .changedirectory commands. If we screw up any of these commands, we get the appropriate error messages. So we know we are logging in properly to the site. The problem occurs when we try to get a file list from the directory. I have used the example you have listed of the .getlist command, what generally happens when we use this is the system hangs for quite a few seconds and then returns no files. I have then switch the command to the getrawlist instead, this does not hang the system, but also produces no results. I noticed that we can use some type of debug dialogue in your documentation, but I am unsure as to how to use this programmatically in my session. Can you give me and example and also a possible thought as to why I cannot get a list of files even with a successful login?

Applies to: Rebex FTP/SSL
by (147k points)
edited

You can easily create a log of communication using Ftp object's LogWriter property - please check out http://www.rebex.net/kb/logging.aspx for more information.

However, if the GetRawList method doesn't return anything, it most likely means that the server itself didn't return any files - the GetRawList method just splits the listing into separate lines and doesn't perform any other kind of processing. Are you able to connect using any other FTP client and get a listing from the same directory?

4 Answers

0 votes
by (310 points)
edited

I can use my ftp client on my mac to get a list of files. Here's another thing I noticed. If I am running the code, using the VS 2008 emulator and my target, I can always get a directory of files, the call never fails. Only when I build the project and run my system standalone that I have the problems. Out of 10 tries to get a directory, 6 out right server time out failures produced by a try catch around get raw files, even though the previous statement is a forced login to make sure, 3 connections, but get raw files returns an empty list of files and 1 good connection where everything worked.

0 votes
by (310 points)
edited

I have generated the following log file when the above problem occurs, any insight would be helpful.

2011-09-01 08:10:11 Opening log file.
2011-09-01 08:10:11 INFO Ftp(1) Info: Connecting to colterpeterson.com:21 using Ftp 3.0.4086.0.
2011-09-01 08:10:11 INFO Ftp(1) Info: Using proxy none.
2011-09-01 08:10:12 DEBUG Ftp(1) Info: Connection succeeded.
2011-09-01 08:10:12 INFO Ftp(1) Response: 220 (vsFTPd 2.0.5)
2011-09-01 08:10:12 INFO Ftp(1) Command: USER cpm
2011-09-01 08:10:12 INFO Ftp(1) Response: 331 Please specify the password.
2011-09-01 08:10:12 INFO Ftp(1) Command: PASS *********
2011-09-01 08:10:12 INFO Ftp(1) Response: 230 Login successful.
2011-09-01 08:10:12 INFO Ftp(1) Command: FEAT
2011-09-01 08:10:12 INFO Ftp(1) Response: 211-Features:
2011-09-01 08:10:12 INFO Ftp(1) Response:  EPRT
2011-09-01 08:10:12 INFO Ftp(1) Response:  EPSV
2011-09-01 08:10:12 INFO Ftp(1) Response:  MDTM
2011-09-01 08:10:12 INFO Ftp(1) Response:  PASV
2011-09-01 08:10:12 INFO Ftp(1) Response:  REST STREAM
2011-09-01 08:10:12 INFO Ftp(1) Response:  SIZE
2011-09-01 08:10:12 INFO Ftp(1) Response:  TVFS
2011-09-01 08:10:12 INFO Ftp(1) Response: 211 End
2011-09-01 08:10:13 INFO Ftp(1) Command: CWD certs
2011-09-01 08:10:13 INFO Ftp(1) Response: 250 Directory successfully changed.
2011-09-01 08:10:13 DEBUG Ftp(1) Info: Starting data transfer.
2011-09-01 08:10:13 INFO Ftp(1) Command: TYPE A
2011-09-01 08:10:13 INFO Ftp(1) Response: 200 Switching to ASCII mode.
2011-09-01 08:10:13 INFO Ftp(1) Command: PASV
2011-09-01 08:10:13 INFO Ftp(1) Response: 227 Entering Passive Mode (173,201,34,112,61,63)
2011-09-01 08:10:13 DEBUG Ftp(1) Info: Establishing data connection to 173.201.34.112:15679.
2011-09-01 08:10:35 DEBUG Ftp(1) Info: Error while starting data transfer: Rebex.Net.FtpException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ---> Rebex.Net.ProxySocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ---> Rebex.Net.ProxySocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
at System.Net.Sockets.Socket.ConnectNoCheck()
at System.Net.Sockets.Socket.Connect()
at wWGvS.BnRMAeZ.kRCyw()
at System.Reflection.RuntimeMethodInfo.InternalInvoke()
at System.Reflection.RuntimeMethodInfo.InternalInvoke()
at System.Reflection.RuntimeMethodInfo.Invoke()
at System.Reflection.MethodBase.Invoke()
at wWGvS.cLikxD.AExGBoZ()
at PyHMxZ.BzmFTt()

at wWGvS.BnRMAeZ.kRCyw()
at System.Reflection.RuntimeMethodInfo.InternalInvoke()
at System.Reflection.RuntimeMethodInfo.InternalInvoke()
at System.Reflection.RuntimeMethodInfo.Invoke()
at System.Reflection.MethodBase.Invoke()
at wWGvS.cLikxD.AExGBoZ()
at PyHMxZ.BzmFTt()

at wWGvS.BnRMAeZ.YqGDG()
at wWGvS.BnRMAeZ.cCoahHZ()
at Rebex.Net.ProxySocket.EndConnect()
at wWGvS.AoLBks.kRCyw()
at Rebex.Net.Ftp.CgtFNEZ()
at Rebex.Net.Ftp.bjMtzmZ()
at Rebex.Net.Ftp.GetList()
at Rebex.Net.Ftp.GetList()
at microcut.Form1.ftp_login()
at microcut.Form1.get_the_files()
at microcut.Form1.process_file_directory()
at microcut.Form1.review_mode_screen()
at microcut.Form1.mode_change()
at microcut.Form1.Form1_MouseDown()
at System.Windows.Forms.Control.OnMouseDown()
at System.Windows.Forms.Control.WnProc()
at System.Windows.Forms.ContainerControl.WnProc()
at System.Windows.Forms.Form.WnProc()
at System.Windows.Forms.Control._InternalWnProc()
at Microsoft.AGL.Forms.EVL.EnterMainLoop()
at System.Windows.Forms.Application.Run()
at microcut.Form1.Main()

at wWGvS.AoLBks.kRCyw()
at Rebex.Net.Ftp.CgtFNEZ()
at Rebex.Net.Ftp.bjMtzmZ()
at Rebex.Net.Ftp.GetList()
at Rebex.Net.Ftp.GetList()
at microcut.Form1.ftp_login()
at microcut.Form1.get_the_files()
at microcut.Form1.process_file_directory()
at microcut.Form1.review_mode_screen()
at microcut.Form1.mode_change()
at microcut.Form1.Form1_MouseDown()
at System.Windows.Forms.Control.OnMouseDown()
at System.Windows.Forms.Control.WnProc()
at System.Windows.Forms.ContainerControl.WnProc()
at System.Windows.Forms.Form.WnProc()
at System.Windows.Forms.Control._InternalWnProc()
at Microsoft.AGL.Forms.EVL.EnterMainLoop()
at System.Windows.Forms.Application.Run()
at microcut.Form1.Main()

2011-09-01 08:10:35 DEBUG Ftp(1) Info: Error while initializing data connection.
2011-09-01 08:10:35 ERROR Ftp(1) Info: Rebex.Net.FtpException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ---> Rebex.Net.ProxySocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ---> Rebex.Net.ProxySocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
at System.Net.Sockets.Socket.ConnectNoCheck()
at System.Net.Sockets.Socket.Connect()
at wWGvS.BnRMAeZ.kRCyw()
at System.Reflection.RuntimeMethodInfo.InternalInvoke()
at System.Reflection.RuntimeMethodInfo.InternalInvoke()
at System.Reflection.RuntimeMethodInfo.Invoke()
at System.Reflection.MethodBase.Invoke()
at wWGvS.cLikxD.AExGBoZ()
at PyHMxZ.BzmFTt()

at wWGvS.BnRMAeZ.kRCyw()
at System.Reflection.RuntimeMethodInfo.InternalInvoke()
at System.Reflection.RuntimeMethodInfo.InternalInvoke()
at System.Reflection.RuntimeMethodInfo.Invoke()
at System.Reflection.MethodBase.Invoke()
at wWGvS.cLikxD.AExGBoZ()
at PyHMxZ.BzmFTt()

at wWGvS.BnRMAeZ.YqGDG()
at wWGvS.BnRMAeZ.cCoahHZ()
at Rebex.Net.ProxySocket.EndConnect()
at wWGvS.AoLBks.kRCyw()
at Rebex.Net.Ftp.CgtFNEZ()
at Rebex.Net.Ftp.bjMtzmZ()
at Rebex.Net.Ftp.GetList()
at Rebex.Net.Ftp.GetList()
at microcut.Form1.ftp_login()
at microcut.Form1.get_the_files()
at microcut.Form1.process_file_directory()
at microcut.Form1.review_mode_screen()
at microcut.Form1.mode_change()
at microcut.Form1.Form1_MouseDown()
at System.Windows.Forms.Control.OnMouseDown()
at System.Windows.Forms.Control.WnProc()
at System.Windows.Forms.ContainerControl.WnProc()
at System.Windows.Forms.Form.WnProc()
at System.Windows.Forms.Control._InternalWnProc()
at Microsoft.AGL.Forms.EVL.EnterMainLoop()
at System.Windows.Forms.Application.Run()
at microcut.Form1.Main()

at wWGvS.AoLBks.kRCyw()
at Rebex.Net.Ftp.CgtFNEZ()
at Rebex.Net.Ftp.bjMtzmZ()
at Rebex.Net.Ftp.GetList()
at Rebex.Net.Ftp.GetList()
at microcut.Form1.ftp_login()
at microcut.Form1.get_the_files()
at microcut.Form1.process_file_directory()
at microcut.Form1.review_mode_screen()
at microcut.Form1.mode_change()
at microcut.Form1.Form1_MouseDown()
at System.Windows.Forms.Control.OnMouseDown()
at System.Windows.Forms.Control.WnProc()
at System.Windows.Forms.ContainerControl.WnProc()
at System.Windows.Forms.Form.WnProc()
at System.Windows.Forms.Control._InternalWnProc()
at Microsoft.AGL.Forms.EVL.EnterMainLoop()
at System.Windows.Forms.Application.Run()
at microcut.Form1.Main()

2011-09-01 08:10:35 ERROR Ftp(1) Info: Rebex.Net.FtpException: A connection attempt failed because the connected party did not properly respond after a period of
0 votes
by (147k points)
edited

Please try enabling this FTP option before calling the GetList/GetRawList method:

C#:

ftp.Options |= FtpOptions.ConnectPassiveLater;

VB.NET

ftp.Options = Ftp.Options Or FtpOptions.ConnectPassiveLater;

(where "ftp" is your instance of Ftp object)

This changes the method of establishing the data connection slightly - it causes it to be initialized only after the LIST/NLST/RETR/STOR command has been sent.

Does this make any difference?

0 votes
by (310 points)
edited

Unfortunately this did not cure the problem, but I have some more insight as to what might be happening. We have more that one manufacturer of embedded boards we use in the field. The hardware specs are exactly the same. The only difference is the CE 5.0 build for the board. I loaded the original code up onto the other manufacturers board, and everything worked perfectly with no connection issues. In this case I contacted the manufacturer of the original board and we are trying to work out the problem from the build end. Unfortunately this may be trying to look for a needle in a haystack. Do you have any suggestions for us on how to proceed in debugging this problem? If not thats okay, I don't expect any.

by (147k points)
edited

At this point, I would try analyzing the network traffic between the client and the server using a network protocol analyzer such as Wireshark. However, unless you have access to the FTP server, the only reasonable place at which to run it (and capture network packets for analysis) would be a Windows or Unix machine inserted between the client and the server (which would act as a router). But even if this revealed some difference, I'm not quite sure how to proceed from there.

...