** The RNFR was OK so now send the RNTO

Return TypeFunction nameArguments
hzEcodehzFtpClient::FileRename(const hzString&,const hzString&,)

Declared in file: hzFtpClient.h
Defined in file : hzFtpClient.cpp

Function Logic:

0:START 1:nTry 2:nTry<2; 3:nTry==1 4:hzTcpClient::Close hzFtpClient::_reconnect rc 5:rc!=E_OK 6:sprintf strlen len 7:(rc=m_ConnControl.Send(m_c_sbuf,len))!=E_OK 8:(rc=_ftprecv(nRecv,*_fn))!=E_OK 9:m_nRescode==350 10:sprintf strlen len 11:(rc=m_ConnControl.Send(m_c_sbuf,len))!=E_OK 12:(rc=_ftprecv(nRecv,*_fn))!=E_OK 13:m_nRescode>=400 14:Return E_NODATA 15:Return E_OK

Function body:

hzEcode hzFtpClient::FileRename (const hzString& oldsvrname, const hzString& newsvrname)
{
   _hzfunc("hzFtpClient::FileRename") ;
   uint32_t    nRecv ;
   uint32_t    len ;
   uint32_t    nTry ;
   hzEcode     rc ;
   /*
   **  ** Send RNFR & RNTO commands and receive resposns, reconnect if required.
   **      */
   for (nTry = 0; nTry < 2; nTry++)
   {
       if (nTry == 1)
       {
           m_ConnControl.Close() ;
           rc = _reconnect() ;
           if (rc != E_OK)
               break ;
       }
       /*
       **  ** Send the RNFR (rename from) command and check the response
       **           */
       sprintf(m_c_sbuf, "RNFR %s\r\n", *oldsvrname) ;
       len = strlen(m_c_sbuf) ;
       if ((rc = m_ConnControl.Send(m_c_sbuf, len)) != E_OK)
       {
           threadLog("Could not send RNFR command (file %s to %s)\n", *oldsvrname, *newsvrname) ;
           continue ;
       }
       if ((rc = _ftprecv(nRecv, *_fn)) != E_OK)
       {
           threadLog("Could not get RNFR response (file %s to %s)\n", *oldsvrname, *newsvrname) ;
           continue ;
       }
       if (m_nRescode == 350)
       {
           /*
           **  ** The RNFR was OK so now send the RNTO
           **                */
           sprintf(m_c_sbuf, "RNTO %s\r\n", *newsvrname) ;
           len = strlen(m_c_sbuf) ;
           if ((rc = m_ConnControl.Send(m_c_sbuf, len)) != E_OK)
           {
               threadLog("Could not send RNTO command (file %s to %s)\n", *oldsvrname, *newsvrname) ;
               continue ;
           }
           if ((rc = _ftprecv(nRecv, *_fn)) != E_OK)
           {
               threadLog("Could not get RNTO response (file %s to %s)\n", *oldsvrname, *newsvrname) ;
               continue ;
           }
       }
       break ;
    }
   /*
   **  ** Check server response
   **      */
    if (m_nRescode >&eq; 400)
    {
       threadLog("Got bad response (%d) to RNFR/RNTO command (file %s to %s)\n", m_nRescode, *oldsvrname, *newsvrname) ;
        return E_NODATA ;
   }
   return E_OK ;
}