FluentFTP
FluentFTP copied to clipboard
When PASV download fails it should fallback to PORT
FTP OS: Windows
FTP Server: Filezilla server
Computer OS: ? Windows 10
FluentFTP Version: 31.3.1
Hello,
After a few dowloadfile() I have an error : Could not create socket on every next ftp command.
Thanks for your help.
Logs :
# GetListing("", Auto)
# GetWorkingDirectory()
Command: PWD
Response: 257 "/" is current directory.
Command: TYPE I
Response: 200 Type set to I
# OpenPassiveDataStream(AutoPassive, "MLSD /", 0)
Command: PASV
Response: 227 Entering Passive Mode (127,0,0,1,242,220)
Status: Connecting to 127.0.0.1:62172
Command: MLSD /
Response: 150 Opening data channel for directory listing of "/"
+---------------------------------------+
Listing: type=dir;modify=20200301220055; chien
Listing: type=file;modify=20191218133536;size=61571872; JabraDirectSetup.exe
Listing: type=file;modify=20190512093554;size=447710060; metronic_v5.5.5.zip
Listing: type=file;modify=20200301215922;size=5; test1.txt
-----------------------------------------
Status: Disposing FtpSocketStream...
# CloseDataStream()
Response: 226 Successfully transferred "/"
Status: Disposing FtpSocketStream...
The thread 0x6984 has exited with code 0 (0x0).
The thread 0x45dc has exited with code 0 (0x0).
The thread 0x66b4 has exited with code 0 (0x0).
The thread 0x6c10 has exited with code 0 (0x0).
The thread 0x3b60 has exited with code 0 (0x0).
The thread 0x6d0 has exited with code 0 (0x0).
The thread 0x4628 has exited with code 0 (0x0).
# DownloadFile("C:\GekkoTempFile\vusim2xf.r25\test1.txt", "\test1.txt", Overwrite, None)
# OpenRead("\test1.txt", Binary, 0)
# OpenPassiveDataStream(AutoPassive, "RETR /test1.txt", 0)
Command: PASV
Response: 227 Entering Passive Mode (127,0,0,1,247,230)
Status: Connecting to 127.0.0.1:63462
Command: RETR /test1.txt
Response: 150 Opening data channel for file download from server of "/test1.txt"
Status: Disposing FtpSocketStream...
Response: 226 Successfully transferred "/test1.txt"
# GetListing("", Auto)
# GetWorkingDirectory()
Command: PWD
Response: 257 "/" is current directory.
Command: TYPE I
Response: 200 Type set to I
# OpenPassiveDataStream(AutoPassive, "MLSD /", 0)
Command: PASV
Response: 421 Could not create socket.
Try with FileZilla client and check if it works? If it does then paste the logs from Filezilla so we can compare....
Hello,
Thanks for your quick reply.
I see the same error with filezilla client but it don't stop like fluent ftp and continue to send a PORT command.
(I have disabled the firewall with same result)
Filezilla client trace :
(000121)07/03/2020 14:23:43 - (not logged in) (127.0.0.1)> 220-FileZilla Server 0.9.60 beta
(000121)07/03/2020 14:23:43 - (not logged in) (127.0.0.1)> 220-written by Tim Kosse ([email protected])
(000121)07/03/2020 14:23:43 - (not logged in) (127.0.0.1)> 220 Please visit https://filezilla-project.org/
(000121)07/03/2020 14:23:43 - (not logged in) (127.0.0.1)> AUTH TLS
(000121)07/03/2020 14:23:43 - (not logged in) (127.0.0.1)> 502 Explicit TLS authentication not allowed
(000121)07/03/2020 14:23:43 - (not logged in) (127.0.0.1)> AUTH SSL
(000121)07/03/2020 14:23:43 - (not logged in) (127.0.0.1)> 502 Explicit TLS authentication not allowed
(000121)07/03/2020 14:23:43 - (not logged in) (127.0.0.1)> USER test
(000121)07/03/2020 14:23:43 - (not logged in ) (127.0.0.1)> 331 Password required for test
(000121)07/03/2020 14:23:43 - (not logged in) (127.0.0.1)> PASS ***
(000121)07/03/2020 14:23:43 - test (127.0.0.1)> 230 Logged on
(000121)07/03/2020 14:23:43 - test (127.0.0.1)> CWD /
(000121)07/03/2020 14:23:43 - test (127.0.0.1)> 250 CWD successful. "/" is current directory.
(000121)07/03/2020 14:23:43 - test (127.0.0.1)> TYPE I
(000121)07/03/2020 14:23:43 - test (127.0.0.1)> 200 Type set to I
(000121)07/03/2020 14:23:43 - test (127.0.0.1)> PASV
(000121)07/03/2020 14:23:43 - test (127.0.0.1)> 421 Could not create socket.
(000121)07/03/2020 14:23:43 - test (127.0.0.1)> PORT 127,0,0,1,197,49
(000121)07/03/2020 14:23:43 - test (127.0.0.1)> 200 Port command successful
(000121)07/03/2020 14:23:43 - test (127.0.0.1)> RETR metronic_v5.5.5.zip
(000121)07/03/2020 14:23:43 - test (127.0.0.1)> 150 Opening data channel for file download from server of "/metronic_v5.5.5.zip"
(000121)07/03/2020 14:23:44 - test (127.0.0.1)> 226 Successfully transferred "/metronic_v5.5.5.zip"
Fluent Ftp trace :
(000135)07/03/2020 14:49:03 - (not logged in) (127.0.0.1)> 220-FileZilla Server 0.9.60 beta
(000135)07/03/2020 14:49:03 - (not logged in) (127.0.0.1)> 220-written by Tim Kosse ([email protected])
(000135)07/03/2020 14:49:03 - (not logged in) (127.0.0.1)> 220 Please visit https://filezilla-project.org/
(000135)07/03/2020 14:49:03 - (not logged in) (127.0.0.1)> USER test
(000135)07/03/2020 14:49:03 - (not logged in) (127.0.0.1)> 331 Password required for test
(000135)07/03/2020 14:49:03 - (not logged in) (127.0.0.1)> PASS ***
(000135)07/03/2020 14:49:03 - test (127.0.0.1)> 230 Logged on
(000135)07/03/2020 14:49:03 - test (127.0.0.1)> FEAT
(000135)07/03/2020 14:49:03 - test (127.0.0.1)> 211-Features:
(000135)07/03/2020 14:49:03 - test (127.0.0.1)> MDTM
(000135)07/03/2020 14:49:03 - test (127.0.0.1)> REST STREAM
(000135)07/03/2020 14:49:03 - test (127.0.0.1)> SIZE
(000135)07/03/2020 14:49:03 - test (127.0.0.1)> MLST type*;size*;modify*;
(000135)07/03/2020 14:49:03 - test (127.0.0.1)> MLSD
(000135)07/03/2020 14:49:03 - test (127.0.0.1)> UTF8
(000135)07/03/2020 14:49:03 - test (127.0.0.1)> CLNT
(000135)07/03/2020 14:49:03 - test (127.0.0.1)> MFMT
(000135)07/03/2020 14:49:03 - test (127.0.0.1)> EPSV
(000135)07/03/2020 14:49:03 - test (127.0.0.1)> EPRT
(000135)07/03/2020 14:49:03 - test (127.0.0.1)> 211 End
(000135)07/03/2020 14:49:03 - test (127.0.0.1)> OPTS UTF8 ON
(000135)07/03/2020 14:49:03 - test (127.0.0.1)> 202 UTF8 mode is always enabled. No need to send this command.
(000135)07/03/2020 14:49:03 - test (127.0.0.1)> SYST
(000135)07/03/2020 14:49:03 - test (127.0.0.1)> 215 UNIX emulated by FileZilla
(000135)07/03/2020 14:49:03 - test (127.0.0.1)> PWD
(000135)07/03/2020 14:49:03 - test (127.0.0.1)> 257 "/" is current directory.
(000135)07/03/2020 14:49:03 - test (127.0.0.1)> TYPE I
(000135)07/03/2020 14:49:03 - test (127.0.0.1)> 200 Type set to I
(000135)07/03/2020 14:49:03 - test (127.0.0.1)> EPSV
(000135)07/03/2020 14:49:03 - test (127.0.0.1)> 421 Could not create socket.
(000135)07/03/2020 14:49:03 - test (127.0.0.1)> PASV
(000135)07/03/2020 14:49:03 - test (127.0.0.1)> 227 Entering Passive Mode (127,0,0,1,200,154)
(000135)07/03/2020 14:49:03 - test (127.0.0.1)> MLSD /
(000135)07/03/2020 14:49:03 - test (127.0.0.1)> 150 Opening data channel for directory listing of "/"
(000135)07/03/2020 14:49:03 - test (127.0.0.1)> 226 Successfully transferred "/"
(000135)07/03/2020 14:49:03 - test (127.0.0.1)> PWD
(000135)07/03/2020 14:49:03 - test (127.0.0.1)> 257 "/" is current directory.
(000135)07/03/2020 14:49:03 - test (127.0.0.1)> TYPE I
(000135)07/03/2020 14:49:03 - test (127.0.0.1)> 200 Type set to I
(000135)07/03/2020 14:49:03 - test (127.0.0.1)> PASV
(000135)07/03/2020 14:49:03 - test (127.0.0.1)> 227 Entering Passive Mode (127,0,0,1,218,22)
(000135)07/03/2020 14:49:03 - test (127.0.0.1)> MLSD /
(000135)07/03/2020 14:49:03 - test (127.0.0.1)> 150 Opening data channel for directory listing of "/"
(000135)07/03/2020 14:49:03 - test (127.0.0.1)> 226 Successfully transferred "/"
(000135)07/03/2020 14:49:07 - test (127.0.0.1)> TYPE I
(000135)07/03/2020 14:49:07 - test (127.0.0.1)> 200 Type set to I
(000135)07/03/2020 14:49:07 - test (127.0.0.1)> PASV
(000135)07/03/2020 14:49:07 - test (127.0.0.1)> 227 Entering Passive Mode (127,0,0,1,245,185)
(000135)07/03/2020 14:49:07 - test (127.0.0.1)> RETR /test1.txt
(000135)07/03/2020 14:49:07 - test (127.0.0.1)> 150 Opening data channel for file download from server of "/test1.txt"
(000135)07/03/2020 14:49:07 - test (127.0.0.1)> 226 Successfully transferred "/test1.txt"
(000135)07/03/2020 14:49:08 - test (127.0.0.1)> PWD
(000135)07/03/2020 14:49:08 - test (127.0.0.1)> 257 "/" is current directory.
(000135)07/03/2020 14:49:08 - test (127.0.0.1)> TYPE I
(000135)07/03/2020 14:49:08 - test (127.0.0.1)> 200 Type set to I
(000135)07/03/2020 14:49:08 - test (127.0.0.1)> PASV
(000135)07/03/2020 14:49:08 - test (127.0.0.1)> 227 Entering Passive Mode (127,0,0,1,200,217)
(000135)07/03/2020 14:49:08 - test (127.0.0.1)> MLSD /
(000135)07/03/2020 14:49:08 - test (127.0.0.1)> 150 Opening data channel for directory listing of "/"
(000135)07/03/2020 14:49:08 - test (127.0.0.1)> 226 Successfully transferred "/"
(000135)07/03/2020 14:49:08 - test (127.0.0.1)> PWD
(000135)07/03/2020 14:49:08 - test (127.0.0.1)> 257 "/" is current directory.
(000135)07/03/2020 14:49:08 - test (127.0.0.1)> TYPE I
(000135)07/03/2020 14:49:08 - test (127.0.0.1)> 200 Type set to I
(000135)07/03/2020 14:49:08 - test (127.0.0.1)> PASV
(000135)07/03/2020 14:49:08 - test (127.0.0.1)> 227 Entering Passive Mode (127,0,0,1,239,63)
(000135)07/03/2020 14:49:08 - test (127.0.0.1)> MLSD /
(000135)07/03/2020 14:49:08 - test (127.0.0.1)> 150 Opening data channel for directory listing of "/"
(000135)07/03/2020 14:49:08 - test (127.0.0.1)> 226 Successfully transferred "/"
(000135)07/03/2020 14:49:08 - test (127.0.0.1)> PWD
(000135)07/03/2020 14:49:08 - test (127.0.0.1)> 257 "/" is current directory.
(000135)07/03/2020 14:49:08 - test (127.0.0.1)> TYPE I
(000135)07/03/2020 14:49:08 - test (127.0.0.1)> 200 Type set to I
(000135)07/03/2020 14:49:08 - test (127.0.0.1)> PASV
(000135)07/03/2020 14:49:08 - test (127.0.0.1)> 421 Could not create socket.
Thanks for the detailed info. This seems to be a smart feature implemented by Filezilla, let me evaluate how to accomplish it and get back to you. When PASV fails its falling back to PORT.
For now set connection type manually and check:
client.DataConnectionType = FtpDataConnectionType.PORT;
Taking inspiration from the filezilla connection, I have greatly improved AutoConnect in v35.
Added to the bucket list. We will pick this up as and when we have free time. Comment on this issue if you want us to prioritize it. Thanks!