This project is read-only.

Testing / Bugs / Results

Apr 13, 2011 at 9:55 PM

The code seems stable and working in all of my tests. I'd appreciate some feedback from people who are already using the code. I'm finding bugs here and there and fixing them as quickly as possible however I haven't really found any show stoppers. One of the things that makes developing FTP client code difficult is the vast array of FTP implementations out there. I can't test all of them so I need to hear from people about what doesn't work and what kind of obscure bugs are being discovered.

Apr 20, 2011 at 10:27 PM

I'm trying to use this against an embedded FTP server which supports only Active connections.  To emulate that (server not yet available) I set up a FileZilla server and I am using your library with the attached code... works fine until it reaches the GetListing call.  Everything works ok if I remove the DefaultDataMode = FtpDataMode.Active.  Is this a bug or am I incorrectly trying to use this with an active mode connection?

using (FtpClient ftp = new FtpClient() { Server = "", Username = "john", Password = "pass1234", DefaultDataMode = FtpDataMode.Active, UseSsl = false })
	FtpListItem[] items = ftp.GetListing();
	foreach (FtpListItem item in items)
		Console.WriteLine("{0} {1}", item.Name, item.Type.ToString());

The exception I get:
System.IO.IOException: Unable to read data from the transport connection: An established connection was aborted by the software in your host machine. ---> System.Net.Sockets.SocketException: An established connection was aborted by the software in your host machine
   at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
   at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
   --- End of inner exception stack trace ---
   at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
   at System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 count)
   at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
   at System.Net.Security.SslStream.AuthenticateAsClient(String targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, Boolean checkCertificateRevocation)
   at System.Net.Security.SslStream.AuthenticateAsClient(String targetHost)
   at System.Net.FtpClient.FtpChannel.AuthenticateConnection()
   at System.Net.FtpClient.FtpDataChannel.ConnectActiveChannel()
   at System.Net.FtpClient.FtpDataChannel.Connect()
   at System.Net.FtpClient.FtpDataChannel.ReadLine()
   at System.Net.FtpClient.FtpClient.GetRawListing(String path, FtpListType type)
   at System.Net.FtpClient.FtpClient.GetListing(String path, FtpListType type)
   at System.Net.FtpClient.FtpClient.GetListing(String path)
   at System.Net.FtpClient.FtpClient.GetListing()
   at HMIConfig.Offloads.Program.ProcessHMIOffloads(HMI hmi)
   at HMIConfig.Offloads.Program.ProcessHMIs()
   at HMIConfig.Offloads.Program.ProcessCommand(Int32 cmd)
   at HMIConfig.Offloads.Program.Run(String[] args)
On the FileZilla server output it looks like it was successful:
(000019)4/20/2011 16:17:08 PM - john (> MLSD /offloads
(000019)4/20/2011 16:17:08 PM - john (> 150 Opening data channel for directory list.
(000019)4/20/2011 16:17:08 PM - john (> 226 Transfer OK
(000019)4/20/2011 16:17:09 PM - john (> QUIT
(000019)4/20/2011 16:17:09 PM - john (> 221 Goodbye
(000019)4/20/2011 16:17:09 PM - john (> disconnected.
Any ideas?  Thanks!

Apr 21, 2011 at 2:15 PM

Sounds like it's possibly a bug. Please define DEBUG in your project and send the output logged to your IDE's output window. Be sure to cut out any sensitive info such as user/pass that was sent to the output window. I've tested active mode transfers using the latest version of FileZilla, do you have any firewall settings that might be blocking active mode? Remember that active mode creates a local listening socket on the client machine.


Apr 21, 2011 at 2:34 PM

Alright, I just found and fixed a bug where SSL was trying to be used in active channels even though it wasn't enabled on the command channel. The exception being thrown was different for me so I don't know if it will correct your problem or not. Please check out revision 2368 and see if it fixes the problem.

Apr 21, 2011 at 3:00 PM

Apparently that was the magic... works like a champ now.   Thanks so much for your timely help, and thanks so much for building this in the first place! :-)

Apr 22, 2011 at 3:24 AM

No problem