Create a directory on the server
| Return Type | Function name | Arguments |
|---|---|---|
| hzEcode | hzFtpClient::RemoteDirCreate | (hzString&,) |
Declared in file: hzFtpClient.h
Defined in file : hzFtpClient.cpp
Function Logic:
Function body:
hzEcode hzFtpClient::RemoteDirCreate (hzString& dir)
{
// Create a directory on the server
//
// Argument: dir The taget remote directory
//
// Returns: E_HOSTFAIL If there was a communication failure and reconnect failed
// E_WRITEFAIL If the requested server directory was not created
// E_OK If the remote working directory was created
_hzfunc("hzFtpClient::RemoteDirCreate") ;
uint32_t nRecv ; // Incoming message length
uint32_t len ; // Outgoing message length
uint32_t nTry ; // Reconections
hzEcode rc ; // Return code
/*
** ** Send MKD 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 CWD command
** */
sprintf(m_c_sbuf, "MKD %s\r\n", *dir) ;
len = strlen(m_c_sbuf) ;
if ((rc = m_ConnControl.Send(m_c_sbuf, len)) != E_OK)
{
threadLog("Could not send MKD command\n") ;
continue ;
}
if ((rc = _ftprecv(nRecv, *_fn)) != E_OK)
{
threadLog("Could not recv MKD response\n") ;
continue ;
}
break ;
}
/*
** ** Check response code
** */
_logrescode() ;
if (m_nRescode != 257)
{
threadLog("Expected a 257 - Got %s\n", m_c_rbuf) ;
return E_WRITEFAIL ;
}
return E_OK ;
}