Java org.apache.sshd.common.SshException:频道已关闭
我试图使用org.apache.sshd.client将内存中的数据作为文件发送到远程服务器 到目前为止,我的代码是:Java org.apache.sshd.common.SshException:频道已关闭,java,ssh,sftp,mina,Java,Ssh,Sftp,Mina,我试图使用org.apache.sshd.client将内存中的数据作为文件发送到远程服务器 到目前为止,我的代码是: // Connect to remote server code sftp = session.createSftpClient(); StringBuilder sb = new StringBuilder(); for (int j = 0; j < 1000; j++) { sb.append("a"); } byte[] data = sb.toStri
// Connect to remote server code
sftp = session.createSftpClient();
StringBuilder sb = new StringBuilder();
for (int j = 0; j < 1000; j++) {
sb.append("a");
}
byte[] data = sb.toString().getBytes(StandardCharsets.UTF_8);
sftp.write(h, 0, data, 0, data.length);
//连接到远程服务器代码
sftp=session.createSftpClient();
StringBuilder sb=新的StringBuilder();
对于(int j=0;j<1000;j++){
某人附加(“a”);
}
byte[]data=sb.toString().getBytes(StandardCharsets.UTF_8);
写入(h,0,数据,0,数据长度);
在我尝试扩大输入数据之前,一切都很好。
我将循环计数从1000设置为1000000。
它不断抛出以下异常:
org.apache.sshd.common.SshException:频道已关闭
我试图将SFTP的[通道打开超时设置得更大,但无法解决此问题
所以我意识到,任何时候数据大小大于256KB,都会抛出异常。我试图编辑IO缓冲区大小、写入缓冲区、读取缓冲区,但问题仍然存在
是否有任何方法可以设置数据大小或解决此问题?提前谢谢大家