FluentFTP: GetListing - One or more errors occurred. ( Received an unexpected EOF or 0 bytes from the transport stream.)

FTP OS: Unix / Windows / Embedded

FTP Server: FileZilla Server 0.9.60

Computer OS: Windows 10

FluentFTP Version: 40.0

Framework: .NET 6

Hi - we have an problem with an FTP Server - where GetListing does throw an exception. Any ideas?

System.AggregateException: “One or more errors occurred. ( Received an unexpected EOF or 0 bytes from the transport stream.)”

System.Private.CoreLib.dll!System.Threading.Tasks.Task.ThrowIfExceptional(bool includeTaskCanceledExceptions) Zeile 1883	C#
System.Private.CoreLib.dll!System.Threading.Tasks.Task.Wait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken) Zeile 2733	C#
System.Private.CoreLib.dll!System.Threading.Tasks.Task.Wait() Zeile 2607	C#
[Warten auf asynchronen Vorgang, Doppelklick oder EINGABE zur Anzeige asynchroner Aufruflisten]	
FluentFTP.dll!FluentFTP.FtpSocketStream.ActivateEncryption(string targethost, System.Security.Cryptography.X509Certificates.X509CertificateCollection clientCerts, System.Security.Authentication.SslProtocols sslProtocols)	Unbekannt
FluentFTP.dll!FluentFTP.FtpClient.OpenPassiveDataStream(FluentFTP.FtpDataConnectionType type, string command, long restart)	Unbekannt
FluentFTP.dll!FluentFTP.FtpClient.OpenDataStream(string command, long restart)	Unbekannt
FluentFTP.dll!FluentFTP.FtpClient.GetListingInternal(string listcmd, FluentFTP.FtpListOption options, bool retry)	Unbekannt
FluentFTP.dll!FluentFTP.FtpClient.GetListing(string path, FluentFTP.FtpListOption options)	Unbekannt
FluentFTP.dll!FluentFTP.FtpClient.GetListing()	Unbekannt

FluentExample.dll!FluentFTPTest.FluentFTP_Error1() Zeile 22 C# FluentExample.dll!Program.<Main>$(string[] args) Zeile 4 C#

Logs :

# AutoConnect()

# AutoDetect(True, False)

# Connect()
Status:   Connecting to ***:21
Response: 220 FileZilla Server 0.9.60 beta written by Tim Kosse (Tim.Kosse@gmx.de) Please visit http://sourceforge.
Status:   Detected FTP server: FileZilla
Command:  AUTH TLS
Response: 234 Using authentication type TLS
Status:   FTPS Authentication Successful
Status:   Time to activate encryption: 0h 0m 0s.  Total Seconds: 0,1323288.
Command:  USER ***
Response: 331 Password required for ***
Command:  PASS ***
Response: 230 Logged on
Command:  PBSZ 0
Response: 200 PBSZ=0
Command:  PROT P
Response: 200 Protection level set to P
Command:  FEAT
Response: 211-Features:
Response: MDTM
Response: REST STREAM
Response: SIZE
Response: MLST type*;size*;modify*;
Response: MLSD
Response: AUTH SSL
Response: AUTH TLS
Response: PROT
Response: PBSZ
Response: UTF8
Response: CLNT
Response: MFMT
Response: EPSV
Response: EPRT
Response: 211 End
Status:   Text encoding: System.Text.UTF8Encoding+UTF8EncodingSealed
Command:  OPTS UTF8 ON
Response: 202 UTF8 mode is always enabled. No need to send this command.
Command:  SYST
Response: 215 UNIX emulated by FileZilla
Status:   Listing parser set to: Machine

# SetWorkingDirectory("OUT")
Command:  CWD OUT
Response: 250 CWD successful. "/OUT" is current directory.

# GetListing(null, Auto)
Command:  PWD
Response: 257 "/OUT" is current directory.
Command:  TYPE I
Response: 200 Type set to I

# OpenPassiveDataStream(PASV, "MLSD /OUT", 0)
Command:  PASV
Response: 227 Entering Passive Mode (94,186,230,134,55,109)
Status:   Connecting to ***:14189
Command:  MLSD /OUT
Response: 150 Opening data channel for directory listing of "/OUT"

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 92 (2 by maintainers)

Most upvoted comments

Ok I have an update for you. I’ve installed the aforementioned version of Filezilla in a Sandbox, only modified the host and see what I get in the server logs (I also enforced FTP over TLS):

(000003)10/24/2022 21:42:53 PM - download (172.18.32.1)> EPSV
(000003)10/24/2022 21:42:53 PM - download (172.18.32.1)> 229 Entering Extended Passive Mode (|||58497|)
(000003)10/24/2022 21:42:53 PM - download (172.18.32.1)> MLSD /
(000003)10/24/2022 21:42:53 PM - download (172.18.32.1)> 150 Opening data channel for directory listing of "/"
(000003)10/24/2022 21:42:53 PM - download (172.18.32.1)> 450 TLS session of data connection has not resumed or the session does not match the control connection
(000003)10/24/2022 21:42:53 PM - download (172.18.32.1)> disconnected.

Interestingly, we both try to connect against the same version of Filezilla - 0.9.60 beta.

i hope this helps:

# AutoConnect()

# AutoDetect(True, False)

# Connect()
Status:   FluentFTP 42.0.0.0
Status:   Connecting to ***:21
Status:   Waiting for a response
Response: 220 FileZilla Server 0.9.60 beta written by Tim Kosse (Tim.Kosse@gmx.de) Please visit http://sourceforge.
Status:   Detected FTP server: FileZilla
Command:  AUTH TLS
Status:   Waiting for response to: AUTH TLS
Response: 234 Using authentication type TLS
Warning:  SSL Buffering force disabled, is .NET 5.0 and later
Status:   FTPS authentication successful, protocol = Tls12
Status:   Time to activate encryption: 0h 0m 0s.  Total Seconds: 0,174901.
Status:   SslStream: Tls12 (Aes256, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, 44550, 256)
Command:  USER ***
Status:   Waiting for response to: USER ***
Response: 331 Password required for ***
Command:  PASS ***
Status:   Waiting for response to: PASS ***
Response: 230 Logged on
Command:  PBSZ 0
Status:   Waiting for response to: PBSZ 0
Response: 200 PBSZ=0
Command:  PROT P
Status:   Waiting for response to: PROT P
Response: 200 Protection level set to P
Command:  FEAT
Status:   Waiting for response to: FEAT
Response: 211-Features:
Response: MDTM
Response: REST STREAM
Response: SIZE
Response: MLST type*;size*;modify*;
Response: MLSD
Response: AUTH SSL
Response: AUTH TLS
Response: PROT
Response: PBSZ
Response: UTF8
Response: CLNT
Response: MFMT
Response: EPSV
Response: EPRT
Response: 211 End
Status:   Text encoding: System.Text.UTF8Encoding+UTF8EncodingSealed
Command:  OPTS UTF8 ON
Status:   Waiting for response to: OPTS UTF8 ON
Response: 202 UTF8 mode is always enabled. No need to send this command.
Command:  SYST
Status:   Waiting for response to: SYST
Response: 215 UNIX emulated by FileZilla
Status:   Listing parser set to: Machine

# SetWorkingDirectory("OUT")
Command:  CWD OUT
Status:   Waiting for response to: CWD OUT
Response: 250 CWD successful. "/OUT" is current directory.

# GetListing(null, Auto)
Command:  PWD
Status:   Waiting for response to: PWD
Response: 257 "/OUT" is current directory.
Command:  TYPE I
Status:   Waiting for response to: TYPE I
Response: 200 Type set to I

# OpenPassiveDataStream(PASV, "MLSD /OUT", 0)
Command:  PASV
Status:   Waiting for response to: PASV
Response: 227 Entering Passive Mode (94,186,230,134,55,31)
Status:   Connecting to ***:14111
Command:  MLSD /OUT
Status:   Waiting for response to: MLSD /OUT
Response: 150 Opening data channel for directory listing of "/OUT"
Warning:  SSL Buffering force disabled, is .NET 5.0 and later
Status:   Disposing FtpSocketStream...
Error:    FTPS Authentication Failed
+---------------------------------------+
-----------------------------------------
Status:   Disposing FtpSocketStream...

# CloseDataStream()
Status:   Waiting for a response
Response: 450 TLS session of data connection has not resumed or the session does not match the control connection
Status:   Disposing FtpSocketStream...
Unhandled exception. FluentFTP.FtpCommandException: Code: 450 Message: TLS session of data connection has not resumed or the session does not match the control connection
   at FluentFTP.FtpClient.GetListingInternal(String listcmd, FtpListOption options, Boolean retry) in C:\Users\martin\Source\Repos\FluentFTP\FluentFTP\Client\SyncClient\GetListing.cs:line 240
   at FluentFTP.FtpClient.GetListing(String path, FtpListOption options) in C:\Users\martin\Source\Repos\FluentFTP\FluentFTP\Client\SyncClient\GetListing.cs:line 95
   at FluentFTP.FtpClient.GetListing() in C:\Users\martin\Source\Repos\FluentFTP\FluentFTP\Client\SyncClient\GetListing.cs:line 28
   at FluentFTPTest.FluentFTP_Error1() in C:\Users\martin\Desktop\FluentExample\FluentExample\Program.cs:line 24
   at Program.<Main>$(String[] args) in C:\Users\martin\Desktop\FluentExample\FluentExample\Program.cs:line 6

For what I found, a windows update introduced in late 2020 led to the problems and the only way to fix it is to uninstall the update doh

Ok, first of thanks incredibly much for your help in this. Awesome results - one could now bisect to find from which version onwards does this not-work/work.

But first, here is another comment:

Given the slightly client-unfriendly reactions of the filezilla-server owner(s) concerning making things work with clients where there were difficulties in the past, we could ourselves say: Looks like someone should update their 5 year old filezilla server.

In this industry a typical reaction could then be: Then this is not our problem. Update the server. Period.

The FluentFTP teams reaction, though, is: As long as others (like you guys, @codengine and @noxe, in this case) are helping us to somehow diagnose this further until we can definitely say that it can’t be solved, we are always ready to investigate this further.

But let’s also always keep in mind that all open issues carry their own priorities, based on the number of affected users and also the comparitive effort needed to work on this, compared to other planned efforts to improve FluentFTP.

Being able to reproduce this is a huge step forward and so this will be investigated further. But please do not be dissapointed if in the end, there might not be any workaround. We will see.

No, this will take a little longer. I will report when I know more and I have another branch to test.

Well, we have learned something (offline): it works when its not .NET 6 - if you use .NET Framework 4.8, no error.

@robinrodricks So now that is at least a little clue as to where to start looking.