Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/181.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 通过SSL/TLS使用Apache Commons上载文件的FTPS失败_Android_Ftps_Sslexception - Fatal编程技术网

Android 通过SSL/TLS使用Apache Commons上载文件的FTPS失败

Android 通过SSL/TLS使用Apache Commons上载文件的FTPS失败,android,ftps,sslexception,Android,Ftps,Sslexception,我正在尝试使用ApacheCommons库在android中实现FTP文件上传。通信必须通过显式TLS身份验证完成。我可以成功登录、连接到服务器并列出文件,但当我尝试将文件存储到服务器时,它会在服务器的目标文件夹中创建一个大小为0的文件,并引发SSLexException:写入错误、管道断开。 如何克服这个问题? 下面是我的代码: FTPSClient ftpClient = new FTPSClient("TLS", false); ftpClient.addProtocolCommandLi

我正在尝试使用ApacheCommons库在android中实现FTP文件上传。通信必须通过显式TLS身份验证完成。我可以成功登录、连接到服务器并列出文件,但当我尝试将文件存储到服务器时,它会在服务器的目标文件夹中创建一个大小为0的文件,并引发SSLexException:写入错误、管道断开。 如何克服这个问题? 下面是我的代码:

FTPSClient ftpClient = new FTPSClient("TLS", false);
ftpClient.addProtocolCommandListener(new PrintCommandListener(new   
KeyManagerFactory kmf =            getInstance(KeyManagerFactory.getDefaultAlgorithm());
kmf.init(null, null);
KeyManager km = kmf.getKeyManagers()[0];
ftpClient.setKeyManager(km);
ftpClient.setBufferSize(1000);
ftpClient.setConnectTimeout(5000);
ftpClient.connect(InetAddress.getByName("server ip address"), 990);
// Set protection buffer size
ftpClient.execPBSZ(0);
// // Set data channel protection to private
ftpClient.execPROT("P");
ftpClient.login("username", "password");
ftpClient.changeWorkingDirectory("/");
ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
ftpClient.enterLocalPassiveMode();
buffInp = new BufferedInputStream(new     FileInputStream(file.getAbsolutePath()));

//throwing exception here
boolean status = ftpClient.storeFile( picture.getName(), buffInp );

可能是服务器问题。突然开始使用相同的代码。