简体   繁体   中英

chilkat error 425 Unable to build data connection TSL session of data connection not resumed

Hi I am trying to copy a file via FTP using chilkat, but I got the error " error 425 Unable to build data connection TSL session of data connection not resumed". It works with filezilla client just fine. Here is the code

    if (!CkGlob.UnlockBundle(BUNDLE_CHILKAT))
    {
      W_WARNING("error while activating Chilkat");
      return;
    }
    cSincFTP.ClearSessionLog();
    if(sParam.sFTP[nFTP].UsaProxy)
    {
      cSincFTP.put_ProxyHostname(sParam.sFTP[nFTP].szServer);
      cSincFTP.put_ProxyPort    (sParam.sFTP[nFTP].unPortaFireWall);
      cSincFTP.put_ProxyUsername(sParam.sFTP[nFTP].szUserName);
      cSincFTP.put_ProxyPassword(sParam.sFTP[nFTP].szSenha);
      //if((nProxyMethod=cSincFTP.DetermineProxyMethod())<=0) return(FALSE);
      cSincFTP.put_ProxyMethod(nProxyMethod);
    }
    cSincFTP.put_Hostname(sParam.sFTP[nFTP].szServer);
    cSincFTP.put_Username(sParam.sFTP[nFTP].szUserName);
    cSincFTP.put_Password(sParam.sFTP[nFTP].szSenha);
    cSincFTP.put_Passive((sParam.sFTP[nFTP].UsaPassiveMode?true:false));
    cSincFTP.put_Port(sParam.sFTP[nFTP].unPortaFTP);

    //Establish an AUTH TLS secure channel after connection on the standard FTP port 21.
    cSincFTP.put_AuthTls((sParam.sFTP[nFTP].unPortaFTP==990?false:true));
    //The Ssl property is for establishing an implicit SSL connection on port 990.
    cSincFTP.put_Ssl((sParam.sFTP[nFTP].unPortaFTP==990?true:false));
    for(;;)
    {
      if(cSincFTP.Connect()!=true)
      {
        auto razao = cSincFTP.get_ConnectFailReason();
        if (razao == 201)
        {
          cSincFTP.put_AuthTls(false);
          cSincFTP.put_AuthSsl(false);
          cSincFTP.put_Ssl(false);
          W_MSG("Not possible to use (TLS/SSL)");
          continue;
        }
        SetCursor(LoadCursor(NULL,IDC_ARROW));
        W_WARNING("Not possible to connect to the FTP server");
        return;
      }
      if(cSincFTP.get_AuthTls()||cSincFTP.get_AuthSsl()||cSincFTP.get_Ssl())
      {
        cSincFTP.ClearControlChannel();
        CkString CkHost;
        cSincFTP.get_Hostname(CkHost);

        //use the EPSV command instead of PASV for passive mode data transfers
        cSincFTP.put_UseEpsv(false);
        //PassiveUseHostAddr property tells the FTP client to discard the IP address part of the PASV response
        //and replace it with the IP address of the already-established control connection
        cSincFTP.put_PassiveUseHostAddr(true);
      }
      cSincFTP.put_KeepSessionLog(true);
      break;
    };
    cSincFTP.DeleteRemoteFile(szRemoteFile1);
    cSincFTP.DeleteRemoteFile(szRemoteFile2);
    cSincFTP.RemoveRemoteDir(szRemoteDir);
    cSincFTP.SetTypeBinary();
    auto res = cSincFTP.ClearControlChannel(); 
    if(cSincFTP.PutFile(szRemoteFile1,szRemoteFile1)!=true)
    {
      //IN here I got the error
    }

The file szRemoteFile1 is created however is empty. Any help?

Updating to the latest version of Chilkat should fix the problem. You're likely using an older version of Chilkat?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM