Filezilla 读取目录列表失败

	Status:	Connecting to 121.4.142.72:21...
	Status:	Connection established, waiting for welcome message...
	Status:	Plain FTP is insecure. Please switch to FTP over TLS.
	Status:	Logged in
	Status:	Retrieving directory listing...
	Command:	PWD
	Response:	257 "/var/ftp/max"
	Command:	TYPE I
	Response:	200 Switching to Binary mode.
	Command:	PASV
	Response:	227 Entering Passive Mode (121,4,142,72,163,101).
	Command:	LIST
	Error:	Connection timed out after 20 seconds of inactivity
	Error:	Failed to retrieve directory listing
	Status:	Disconnected from server
	Status:	Connecting to 121.4.142.72:21...
	Status:	Connection established, waiting for welcome message...
	Status:	Plain FTP is insecure. Please switch to FTP over TLS.
	Status:	Logged in
	Status:	Retrieving directory listing...
	Command:	PWD
	Response:	257 "/var/ftp/max"
	Command:	TYPE I
	Response:	200 Switching to Binary mode.
	Command:	PASV
	Response:	227 Entering Passive Mode (121,4,142,72,165,79).
	Command:	LIST
	Error:	Connection timed out after 20 seconds of inactivity
	Error:	Failed to retrieve directory listing

中文:

		状态:	正在连接 121.4.142.72:21...
		状态:	连接建立,等待欢迎消息...
		状态:	不安全的服务器,不支持 FTP over TLS。
		状态:	已登录
		状态:	读取目录列表...
		命令:	PWD
		响应:	257 "/var/ftp/max"
		命令:	TYPE I
		响应:	200 Switching to Binary mode.
		命令:	PASV
		响应:	227 Entering Passive Mode (121,4,142,72,167,199).
		命令:	LIST
		错误:	20 秒后无活动,连接超时
		错误:	读取目录列表失败
		状态:	已从服务器断开

解决方法1

文件 -> 站点管理器 -> 选择你的站点 -> 使用明文的FTP
在这里插入图片描述
不过这样传输不安全.

解决方法2

文件 -> 站点管理器 -> 选择你的站点 -> 传输模式 -> 主动

在这里插入图片描述

QTcpSocket是Qt库中的一个类,它代表了一个TCP套接字,用于网络通信。如果你想通过FileZilla服务器(通常是一个FTP服务器)连接并读取数据,你可以按照以下步骤操作: 1. **设置连接**: 首先,你需要创建一个`QTcpSocket`实例,并尝试连接到FileZilla服务器的IP地址和端口。例如: ```cpp QTcpSocket socket; if (!socket.connectToHost("filezilla_server_ip", FILEZILLA_SERVER_PORT)) { qDebug() << "Failed to connect to FileZilla server"; // 处理连接失败 } ``` 2. **验证身份**: 成功连接后,通常需要进行FTP认证,发送USER和PASS命令。这通常是通过字符串流(QTextStream)进行操作: ```cpp QTextStream request(&socket); request << "USER username" << endl; request << "PASS password" << endl; ``` 3. **打开文件**: 认证成功后,你可以使用`FTP commands`(如`LIST`, `RETR file_name`等)来获取目录列表或下载文件。例如,列出目录内容: ```cpp request << "LIST" << endl; QByteArray response = socket.readAll(); ``` 4. **解析数据**: 解析`response`的内容来获取文件名、大小和其他信息。对于二进制数据(比如文件),你可能需要读取整个文件。 5. **关闭连接**: 当完成操作后记得关闭连接: ```cpp socket.disconnectFromHost(); ``` 注意,这只是一个基本的示例,实际的FTP协议可能会更复杂,包括错误处理、异常处理和协议细节。而且,FileZilla服务器可能会提供API或者其他方法来简化连接过程,具体取决于其API文档。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值