** Check respons is valid
| Return Type | Function name | Arguments |
|---|---|---|
| hzEcode | hzFtpClient::GetServerDir | (void) |
Declared in file: hzFtpClient.h
Defined in file : hzFtpClient.cpp
Function Logic:
Function body:
hzEcode hzFtpClient::GetServerDir (void)
{
_hzfunc("hzFtpClient::GetServerDir") ;
char* i ;
char* j ;
uint32_t nRecv ;
uint32_t len ;
uint32_t nTry ;
hzEcode rc ;
/*
** ** Send PWD command 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 PWD command, recv response
** */
sprintf(m_c_sbuf, "PWD\r\n") ;
len = strlen(m_c_sbuf) ;
if ((rc = m_ConnControl.Send(m_c_sbuf, len)) != E_OK)
{
threadLog("Could not send PWD command\n") ;
continue ;
}
if ((rc = _ftprecv(nRecv, *_fn)) != E_OK)
{
threadLog("Could not recv response to PWD command\n") ;
continue ;
}
break ;
}
if (rc == E_OK)
{
/*
** ** Check respons is valid
** */
_logrescode() ;
if (m_nRescode != 257)
{
threadLog("Expected a 257 return code, got %d\n", m_nRescode) ;
rc = E_PROTOCOL ;
}
}
if (rc == E_OK)
{
/*
** ** Set our record of the current server directory
** */
for (i = m_c_rbuf ; *i && *i != CHAR_DQUOTE ; i++)
if (*i)
{
i++ ;
for (j = i ; *j && *j != CHAR_DQUOTE ; j++) ;
*j = 0;
}
if (m_ServerDir != i)
m_ServerDir = i ;
m_nTries = 0;
return E_OK ;
}
threadLog("Could not get server directory\n") ;
return rc ;
}