GetItems over SSL - "The server has closed the connection"

0 votes
asked Apr 22, 2014 by Alon (120 points)
edited Apr 22, 2014

Hi,

When running the following code:

var items = ftp.GetItems("ftps://user:pass/127.0.0.1/some folder");

on a local FileZilla FTP server (v0.9.43 - newest version available) i get the following exception (copyied it from your log file):

2014-04-22 11:18:52.767 DEBUG Ftp(1)[10] Info: Error while starting data transfer: Rebex.Net.FtpException: The server has closed the connection. ---> Rebex.Net.TlsException: Secure connection was closed by the remote connection end. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
   at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
   at Rebex.Net.ProxySocket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
   at Rebex.Net.EZ.CD(Int32 A, Boolean B)
   at Rebex.Net.EZ.DD()
   at Rebex.Net.EZ.ED()
   --- End of inner exception stack trace ---
   at Rebex.Net.EZ.ED()
   at Rebex.Net.TlsSocket.Poll(Int32 microSeconds, SocketSelectMode mode)
   at Rebex.Net.JJ.ZB(Int32 A)
   at Rebex.Net.JJ.XB(Int32 A)
   --- End of inner exception stack trace ---
   at Rebex.Net.JJ.XB(Int32 A)
   at Rebex.Net.JJ.BC(String& A, Int32 B)
   at Rebex.Net.JJ.DC(Int32 A)
   at Rebex.Net.JJ.DC()
   at Rebex.Net.Ftp.ZK(Int32 A, Boolean B)
   at Rebex.Net.Ftp.ZK(Int32 A)
   at Rebex.Net.Ftp.KL(String A, Boolean B, WJ C, DH D, Int64 E, FtpTransferState H)

Note that the same query works fine when i use it with 'ftp' prefix instead of 'ftps' and that shorter queries (listing a folder with 3-4 files) are working fine over ssl.

Thanx,

Alon

Applies to: Rebex FTP/SSL
commented Apr 22, 2014 by Tomas Knopp (58,890 points)
edited Apr 22, 2014

Hi,

could you please send us the whole log file? Either post it here or send it to support@rebex.net. We would be able to tell what's actually going on based on the log. Thanks!

commented Apr 22, 2014 by Alon (120 points)
edited Apr 22, 2014

I've sent the log file. It may also be a good idea to mention that i'm trying to list a folder with around 20,000 files and folders...

1 Answer

0 votes
answered Apr 22, 2014 by Tomas Knopp (58,890 points)
edited Apr 22, 2014

Thank you for the log file! From the Rebex FTP client point of view it looks like the server actually closes the connection when data is being read and the transfer is in progress (at 2014-04-22 11:18:52.750):

2014-04-22 11:18:52.714 INFO Ftp(1)[10] Command: MLSD
2014-04-22 11:18:52.750 DEBUG Ftp(1)[10] Info: Control connection was forcibly closed.
2014-04-22 11:18:52.757 DEBUG Ftp(1)[10] Info: Control connection was closed, closing current data connection as well.
2014-04-22 11:18:52.767 DEBUG Ftp(1)[10] Info: Error while starting data transfer: Rebex.Net.FtpException: The server has closed the connection. ---> Rebex.Net.TlsException: Secure connection was closed by the remote connection end. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
   at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
   at Rebex.Net.ProxySocket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
   at Rebex.Net.EZ.CD(Int32 A, Boolean B)
   at Rebex.Net.EZ.DD()
   at Rebex.Net.EZ.ED()

As you run the server locally, could you please check the FTP server log and see what is happening at the server side at the time of the closed connection?

...