FVSDK_ERROR_CODE FVSDK_SendCommand(FVSDK_Session* pSession, LPCTSTR pszCommand, int* pnResp);
Sends a command to the connected FTP server. The command can be any NULL terminated string that the server recognizes as a command. FTP Voyager SDK does not interpret the command in anyway; it will simply send the command to the server and wait for a response. For example, if a LIST command is sent via FVSDK_SendCommand(), the corresponding PORT or PASV command will NOT be issued by FVSDK and a data connection to the server will not be established.
A good use for this function is when special commands need to be executed after logging in so the server knows how to operate, or to get special information about a file or folder. Server specific SITE commands are a good example of this.
To retrieve the entire response from this command, not just the numerical response code contained in pnResp, use FVSDK_GetLastResponse() after sending the command.
pszCommand
A NULL terminated string to send to the server.
pnResp
A pointer to an integer value that is to receive the server's response code, or other errors. A negative value usually indicates a communication problem or timeout while waiting for the server's response.
FVSDK_OK if successful, FVSDK_NO, if not. Error codes can be found in FVSDK_ErrorCodes.h.
int nResp;
// send a command to the server to set a file's properties
if (FVSDK_SendCommand(pSession, "SITE CHMOD 700 file.fid", &nResp) == FVSDK_OK) {
CString sMsg;
// format a message for the user
sMsg.Format("The response to the CHMOD command is: %d", nResp);
// put up a message box telling the user what happened
AfxMessageBox(sMsg, (MB_ICONINFORMATION | MB_OK));
} // if
else
AfxMessageBox("Error sending the CHMOD command to the server.", (MB_ICONEXCLAMATION | MB_OK));