Android Apache org.Apache.commons.net FTPSClient连接速度非常慢
我正在Android中使用Android Apache org.Apache.commons.net FTPSClient连接速度非常慢,android,apache,certificate,connect,ftps,Android,Apache,Certificate,Connect,Ftps,我正在Android中使用org.apache.commons.net.FTPSClient,我正在尝试通过FTPS连接到FTP服务器 FTPSClient的连接方法非常慢,这似乎取决于Android版本 在装有安卓6.0.1的Nexus6上,连接呼叫平均需要5秒。 在装有安卓4.3的Galaxy Nexus上,它平均只需要1-2秒 SSLContext sslContext; try { sslContext = SSLContext.getInstance("TLS"); s
org.apache.commons.net.FTPSClient
,我正在尝试通过FTPS连接到FTP服务器
FTPSClient的连接方法非常慢,这似乎取决于Android版本
在装有安卓6.0.1的Nexus6上,连接呼叫平均需要5秒。
在装有安卓4.3的Galaxy Nexus上,它平均只需要1-2秒
SSLContext sslContext;
try {
sslContext = SSLContext.getInstance("TLS");
sslContext.init(
null,
new TrustManager[]{...<custom trust manager stuff>...},
null
);
} catch (NoSuchAlgorithmException nsae) {
FileLog.e(TAG, "No such algorithm: TLS: " + nsae.getMessage());
return null;
} catch (KeyManagementException kme) {
FileLog.e(TAG, "Key management problem: " + kme.getMessage());
return null;
}
FTPSClient client = new FTPSClient(sslContext);
client.setControlEncoding("UTF-8");
client.connect(ip, port); // <---- needs a long time
SSLContext-SSLContext;
试一试{
sslContext=sslContext.getInstance(“TLS”);
sslContext.init(
无效的
新的信任管理器[]{……},
无效的
);
}捕获(无算法异常nsae){
e(标记“无此类算法:TLS:+nsae.getMessage()”);
返回null;
}捕获(密钥管理异常kme){
e(标记,“密钥管理问题:+kme.getMessage());
返回null;
}
FTPSClient=新的FTPSClient(sslContext);
客户端。setControlEncoding(“UTF-8”);
client.connect(ip,端口)//