Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/219.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Apache org.Apache.commons.net FTPSClient连接速度非常慢_Android_Apache_Certificate_Connect_Ftps - Fatal编程技术网

Android Apache org.Apache.commons.net FTPSClient连接速度非常慢

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

我正在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");
    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,端口)//