You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Android FTPS上传报错‘425无法建立数据连接:未恢复TLS会话’求助

Android FTPS客户端TLS会话复用问题(连接FileZilla Server失败)

我在Android应用中尝试连接并上传文件到FTPS服务器(使用21端口的带TLS的FTP,服务器为FileZilla Server,FileZilla客户端可正常连接操作),采用的FTPS客户端库依赖为:

implementation 'commons-net:commons-net:3.11.1' // FTP

登录后执行目录列表或文件名查询操作时,遇到如下错误:

425 Unable to build data connection: TLS session of data connection not resumed.

经调研确认,Apache Commons Net库本身不支持TLS会话复用,而该功能是当前服务器安全传输要求的必要条件——服务器期望数据连接复用控制连接的同一TLS会话,但客户端每次传输都会创建新会话。

已尝试的解决方案均无效:

  • 参照Java 7/8环境下的FTPS会话复用方案实现,执行后报错:
    No field sessionsByHostAndPort in class Lcom/android/org/conscrypt/ClientSessionContext; (declaration of 'com.android.org.conscrypt.ClientSessionContext' appears in /apex/com.android.conscrypt/javalib/conscrypt.jar)
    
  • 引入BouncyCastle库处理TLS,依赖配置如下,未解决问题:
    implementation 'org.bouncycastle:bctls-jdk18on:1.78.1'
    
  • 重写FTPSClient的_prepareDataSocket_方法,未达到预期效果

现寻求可在Android环境下实现FTPS数据连接TLS会话复用的可行方案。

内容的提问来源于stack exchange,提问作者Raja Saad

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.18 02:50:03