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:

hzEcodeFileDelete(hzString& SvrFilename)Delete a file on the server
hzEcodeFileDownload(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.
hzEcodeFileRename(hzString& oldsvrname)hzString& newsvrname, Rename a file on the server
hzEcodeFileUpload(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.
hzEcodeGetDirList(hzVect<hzDirent>& listing)hzString& Criteria, Get a directory listing filtered by search criteria
hzEcodeGetServerDir(void)Obtain the current working directory on the server Arguments: None
hzEcodeInitialize(hzString& server)hzString& username, hzString& password,
hzEcodeQuitSession(void)Sends a QUIT command to the FTP server to end the session Arguments: None
hzEcodeRemoteDirCreate(hzString& dir)Create a directory on the server
hzEcodeRemoteDirDelete(hzString& SvrDirname)Delete a directory on the server
voidSetDebug(bool bDebug)
hzEcodeSetLocalDir(hzString& dir)Set the working directory on the local machine
hzEcodeSetRemoteDir(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.
hzEcodeStartSession(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_ArrayFor processing port nos etc
hzTcpClientm_ConnControlTCP control client object
hzStringm_LocalDirCurrent local directory
hzStringm_PasswordPassword
hzStringm_ServerServer to connect to
hzStringm_ServerDirCurrent remote directory
hzVect<hzFtpClient::_ftpline>m_StackServer response stack
hzIpaddrm_SvrAddrServer IP
hzStringm_UsernameUsername
boolm_bDebugReport conversation in full rather than errors only
boolm_bInitFTP client initialized
char*m_c_rbufControl recv buffer
char*m_c_sbufControl send buffer
uint32_tm_nDataPortPort for connecting for data
uint32_tm_nRescodeReturn code in server response
uint32_tm_nTriesReconnection tries
char*m_x_rbufData recv buffer
char*m_x_sbufData send buffer