小编Gre*_*imo的帖子

连接被对等方重置:ftp 期间套接字写入错误

在尝试将文件 ftp(使用隐式 ssl)到服务器时,我始终收到“对等方重置连接:套接字写入错误”或异常“软件中止连接”错误。文件已上传到服务器,但完全是空的。但是,在设置本地测试 ftp 服务器后,我将文件上传到该服务器没有任何问题。这些错误可能是由某种类型的防火墙引起的吗?如果没有,是否还有其他问题。如果是的话,可以更改代码中的任何内容来修复它吗?

使用 Apache Commons:

String SFTPHOST = compParam.getSftpHostNme();
int SFTPPORT = 990;
String SFTPUSER = compParam.getSftpLogin();
String SFTPPASS = compParam.getSftpPassword();
            FTPSClient ftpClient = new FTPSClient(true);
    try {

        ftpClient.connect(SFTPHOST, SFTPPORT);
        if(!ftpClient.login(SFTPUSER, SFTPPASS)){
            SwingUtils.showMessage(this, "Error: Trouble Connecting \n" + "User Name and Password or Host is incorrect \n"
                    + "or someone else is using these credentials");
            return;
        }
        ftpClient.enterLocalPassiveMode();
        ftpClient.setFileType(FTP.ASCII_FILE_TYPE);

        File f = new File(TLCTripRecordExportDlg.filePath + TLCTripRecordExportDlg.fileName);

        String remoteFile = TLCTripRecordExportDlg.fileName;
  FileInputStream inputStream = new FileInputStream(f);
  ProgressMonitorInputStream pmiStream …
Run Code Online (Sandbox Code Playgroud)

sockets ftp ioexception socketexception

5
推荐指数
1
解决办法
4522
查看次数

标签 统计

ftp ×1

ioexception ×1

socketexception ×1

sockets ×1