Closed adfansong closed 8 months ago
I need to see a complete log, (nearly) all the responses are missing (or are there none?).
[Verbose] Status: Waiting for response to: RETR /2.dzip
Why does this appear 3 times? Need to see your source code.
What is the server type? FileZilla or IIS? Which version FileZilla?
Using Mono: always a bit difficult to help with that. Please supply more information.
Oh, and try using passive FTP mode instead of ACTIVE mode.
I need to see a complete log, (nearly) all the responses are missing (or are there none?).
[Verbose] Status: Waiting for response to: RETR /2.dzip
Why does this appear 3 times? Need to see your source code.
What is the server type? FileZilla or IIS? Which version FileZilla?
Using Mono: always a bit difficult to help with that. Please supply more information.
Thanks for your reply.
[Verbose] > Connect(False)
[Verbose] Status: FluentFTP 49.0.2.0(.NET Standard 2.1) AsyncFtpClient
[Info] Status: Connecting to IP #1= ***:21
[Verbose] Status: Waiting for a response
[Verbose] Response: 220-FileZilla Server 1.8.1
[Info] Response: 220 Please visit https://filezilla-project.org/ [738944.456d]
[Info] Status: Detected FTP server: FileZilla
[Info] Command: USER ***
[Verbose] Status: Waiting for response to: USER ***
[Info] Response: 331 Please, specify the password. [109ms]
[Info] Command: PASS ***
[Verbose] Status: Waiting for response to: PASS ***
[Info] Response: 230 Login successful. [139ms]
[Info] Command: FEAT
[Verbose] Status: Waiting for response to: FEAT
[Verbose] Response: 211-Features: Response: MDTM Response: REST STREAM Response: SIZE Response: MLST type;size;modify;perm; Response: MLSD Response: AUTH SSL Response: AUTH TLS Response: PROT Response: PBSZ Response: UTF8 Response: TVFS Response: EPSV Response: EPRT Response: MFMT
[Info] Response: 211 End [444ms]
[Info] Status: Text encoding: System.Text.UTF8Encoding
[Info] Command: OPTS UTF8 ON
[Verbose] Status: Waiting for response to: OPTS UTF8 ON
[Info] Response: 202 UTF8 mode is always enabled. No need to send this command [187ms]
[Info] Command: SYST
[Verbose] Status: Waiting for response to: SYST
[Info] Response: 215 UNIX emulated by FileZilla. [81ms]
[Verbose] Status: Active ServerHandler is: FileZilla
[Verbose] Status: Listing parser set to: Machine
[Info] Command: PWD
[Verbose] Status: Waiting for response to: PWD
[Info] Response: 257 "/" is current directory. [75ms]
connected.
[Verbose] > DownloadFile("e://soft/download/1.dzip", "/1.dzip", Resume, None)
[Verbose] > OpenRead("/1.dzip", Binary, 0, 0, False)
[Verbose] > GetFileSize("/1.dzip", -1)
[Info] Command: SIZE /1.dzip
[Verbose] Status: Waiting for response to: SIZE /1.dzip
[Info] Response: 213 346 [23ms]
[Info] Command: TYPE I
[Verbose] Status: Waiting for response to: TYPE I
[Info] Response: 200 Type set to I [50ms]
[Verbose] > OpenDataStreamAsync("RETR /1.dzip", 0)
[Verbose] > OpenPassiveDataStreamAsync(AutoPassive, "RETR /1.dzip", 0)
[Info] Command: EPSV
[Verbose] Status: Waiting for response to: EPSV
[Info] Response: 229 Entering Extended Passive Mode (|||11382|) [139ms]
[Info] Status: Connecting to IP #1= ***:11382
[Info] Command: RETR /1.dzip
[Verbose] Status: Waiting for response to: RETR /1.dzip
[Info] Response: 150 Starting data transfer. [72ms]
[Verbose] Status: Downloaded 346 bytes
[Verbose] Status: AsyncFtpClient incorrectly called Close(sync)
[Verbose] Status: Disposing(sync) FtpSocketStream(data connection of AsyncFtpClient)
[Verbose] > CloseDataStream()
[Verbose] Status: Waiting for response to: RETR /1.dzip
[Info] Response: 226 Operation successful [93ms]
[Verbose] Status: Waiting for response to: RETR /1.dzip
[Verbose] Status: Disposing(async) FtpSocketStream(control connection of AsyncFtpClient)
[Verbose] Status: AsyncFtpClient incorrectly called Close(sync)
TimeoutException: Timed out trying to read data from the socket stream!
[stack.txt](https://github.com/robinrodricks/FluentFTP/files/14446891/stack.txt)
2.
The test code:
using System; using System.Collections; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using FluentFTP; using UnityEngine;
public class FluentFTPTest : MonoBehaviour { public string host = "192.168.0.103"; public string user = "test"; public string pwd = "123"; public int port = 0;
private AsyncFtpClient client;
// Start is called before the first frame update
void Start() {
testCo();
}
async Task testCo() {
try {
var tokenSource = new CancellationTokenSource();
var client = new AsyncFtpClient(host, user, pwd, port);
// TEST
client.Config.LogToConsole = true;
client.Config.DataConnectionType = FtpDataConnectionType.AutoPassive;
client.LegacyLogger = (level, s) => {
Debug.Log($"[{level}] {s}");
};
await client.Connect(tokenSource.Token);
Debug.Log("connected.");
await client.DownloadFile("e://soft/download/1.dzip", "/1.dzip", token:tokenSource.Token);
Debug.Log("done.");
} catch (Exception e) {
Debug.LogException(e);
throw;
}
}
}
for 3 times:
1) FtpSocketStream/<WriteAsync>
2) .AsyncFtpClient/<DownloadFileInternalAsync> -> FtpDataStream:Close
3) .AsyncFtpClient/<DownloadFileInternalAsync> -> GetReplyInternal
3. Now I use FileZilla Server 1.8.1, IIS the same before
Oh, and try using passive FTP mode instead of ACTIVE mode.
How to set that?
I tried to set DataConnectionType to AutoPassive / PASV, same error.
Ok, I see the source code.
And I made a mistake concerning ACTIVE/PASSIVE, I was in a hurry. It is PASSIVE (see the EPSV, means extended passive mode). My bad.
I am able to reproduce the problem and am looking for a fix. Thanks for reporting this!
@adfansong I merged a fix for this and perhaps you can check it out on the current master?
@adfansong I merged a fix for this and perhaps you can check it out on the current master?
Thanks for your quick support, it's ok now!
FTP Server OS: Windows
FTP Server Type: Windows Server IIS / FileZilla
Client Computer OS: Windows / iOS
FluentFTP Version: 49.0.2.0
Framework: Mono netstd2.1 / net462
I used AsyncFtpClient to DownloadFile and UploadFile async. After all bytes finished, it keeps waiting for response until timeout.
Logs :