Defined in file: hzFtpClient.h
The hzFtpClient class operates as an FTP client allowing applications to download and upload files from and to a remote server.
This class employes the private sub-class _ftpline as follows:-
_ftpline
Constructors/Detructors
| hzFtpClient* | hzFtpClient | (void) | |
| void | ~hzFtpClient | (void) |
Public Methods:
| hzEcode | FileDelete | (hzString& SvrFilename) | Delete a file on the server |
| hzEcode | FileDownload | (hzDirent& finfo) | Downloads a file from the FTP server. This is a two-step process of firstly sending of a PASV command to open the data channel and secondly the download over the data channel. The data channel is closed after the download so this function is called for every file required. |
| hzEcode | FileRename | (hzString& oldsvrname)hzString& newsvrname, | Rename a file on the server |
| hzEcode | FileUpload | (hzString& SvrFilename)hzString& LocFilename, | Uploads a file to the FTP server. This involves both the sending of a PASV command to open the data channel and the upload over the data channel. The data channel is closed after the upload so this function is called for every file required. |
| hzEcode | GetDirList | (hzVect<hzDirent>& listing)hzString& Criteria, | Get a directory listing filtered by search criteria |
| hzEcode | GetServerDir | (void) | Obtain the current working directory on the server Arguments: None |
| hzEcode | Initialize | (hzString& server)hzString& username, hzString& password, | |
| hzEcode | QuitSession | (void) | Sends a QUIT command to the FTP server to end the session Arguments: None |
| hzEcode | RemoteDirCreate | (hzString& dir) | Create a directory on the server |
| hzEcode | RemoteDirDelete | (hzString& SvrDirname) | Delete a directory on the server |
| void | SetDebug | (bool bDebug) | |
| hzEcode | SetLocalDir | (hzString& dir) | Set the working directory on the local machine |
| hzEcode | SetRemoteDir | (hzString& dir) | Changes the directory on the server to either an absolute or relative path. This also sets the member m_ServerDir which tracks the server directory. The protocol is simple. The client sends a CWD with the supplied argument. The server either returns a 250 if the directory was changed or it returns a 550 if there is no such directory. |
| hzEcode | StartSession | (void) | Start an FTP session (establish a connection witht the FTP server) Arguments: None |
| hzEcode | _ftprecv | (uint32_t& nRecv)const char* callFn, | Recieve data from the FTP control channel |
| void | _logrescode | (void) | Report FTP return codes to the logfile of the current thread Returns: None |
| hzEcode | _openpasv | (hzTcpClient& X) | Sends a PASV command to the FTP server and opens a data channel. Return values are as follows:- Scope: Private to the hzFtpClient class. |
| hzEcode | _reconnect | (void) | In the event of a disconnection, reconnect to server and restore the session in full. Note that this differs from the original connect call in that the possible outcomes no longer scanarios like server not found. Arguments: None |
| hzEcode | _setmetafile | (hzDirent& meta)char* line, | Set file metadata (hzDirent) with a line from the server's directory listing. |
Member Variables:
| hzArray<hzString> | m_Array | For processing port nos etc | |
| hzTcpClient | m_ConnControl | TCP control client object | |
| hzString | m_LocalDir | Current local directory | |
| hzString | m_Password | Password | |
| hzString | m_Server | Server to connect to | |
| hzString | m_ServerDir | Current remote directory | |
| hzVect<hzFtpClient::_ftpline> | m_Stack | Server response stack | |
| hzIpaddr | m_SvrAddr | Server IP | |
| hzString | m_Username | Username | |
| bool | m_bDebug | Report conversation in full rather than errors only | |
| bool | m_bInit | FTP client initialized | |
| char* | m_c_rbuf | Control recv buffer | |
| char* | m_c_sbuf | Control send buffer | |
| uint32_t | m_nDataPort | Port for connecting for data | |
| uint32_t | m_nRescode | Return code in server response | |
| uint32_t | m_nTries | Reconnection tries | |
| char* | m_x_rbuf | Data recv buffer | |
| char* | m_x_sbuf | Data send buffer |