PTLib  Version 2.10.4
PFTPClient Class Reference

File Transfer Protocol client channel class. More...

#include <ftp.h>

Inheritance diagram for PFTPClient:
PFTP PInternetProtocol PIndirectChannel PChannel PObject

List of all members.

Public Member Functions

 PFTPClient ()
 Declare an FTP client socket.
 ~PFTPClient ()
 Delete and close the socket.
Overrides from class PSocket.
virtual PBoolean Close ()
 Close the socket, and if connected as a client, QUITs from server.
New functions for class
bool OpenHost (const PString &host, WORD port=DefaultPort)
 Open host using TCP.
PBoolean LogIn (const PString &username, const PString &password)
 Log in to the remote host for FTP.
PString GetSystemType ()
 Get the type of the remote FTP server system, eg Unix, WindowsNT etc.
PBoolean SetType (RepresentationType type)
 Set the transfer type.
PBoolean ChangeDirectory (const PString &dirPath)
 Change the current directory on the remote FTP host.
PString GetCurrentDirectory ()
 Get the current working directory on the remote FTP host.
PStringArray GetDirectoryNames (NameTypes type=ShortNames, DataChannelType channel=Passive)
 Get a list of files from the current working directory on the remote FTP host.
PStringArray GetDirectoryNames (const PString &path, NameTypes type=ShortNames, DataChannelType channel=Passive)
 Get a list of files from the current working directory on the remote FTP host.
PBoolean CreateDirectory (const PString &path)
 Create a directory on the remote FTP host.
PString GetFileStatus (const PString &path, DataChannelType channel=Passive)
 Get status information for the file path specified.
PTCPSocketGetFile (const PString &filename, DataChannelType channel=Passive)
 Begin retreiving a file from the remote FTP server.
PTCPSocketPutFile (const PString &filename, DataChannelType channel=Passive)
 Begin storing a file to the remote FTP server.
PTCPSocketGetURL (const PURL &url, RepresentationType type, DataChannelType channel=Passive)
 Begin retreiving a file from the remote FTP server.

Protected Member Functions

virtual PBoolean OnOpen ()
 Call back to verify open succeeded in an PInternetProtocol class.
PTCPSocketNormalClientTransfer (Commands cmd, const PString &args)
PTCPSocketPassiveClientTransfer (Commands cmd, const PString &args)

Protected Attributes

WORD remotePort
 Port number on remote system.

Detailed Description

File Transfer Protocol client channel class.


Constructor & Destructor Documentation

Declare an FTP client socket.

Delete and close the socket.


Member Function Documentation

Change the current directory on the remote FTP host.

Returns:
true if the log in was successfull.
Parameters:
dirPathNew directory
virtual PBoolean PFTPClient::Close ( ) [virtual]

Close the socket, and if connected as a client, QUITs from server.

Returns:
true if the channel was closed and the QUIT accepted by the server.

Reimplemented from PIndirectChannel.

Create a directory on the remote FTP host.

Returns:
true if the directory was created successfully.
Parameters:
pathName of the directory to create.

Get the current working directory on the remote FTP host.

Returns:
String for the directory path, or empty string if an error occurred.

Get a list of files from the current working directory on the remote FTP host.

Returns:
String array for the files in the directory.
Parameters:
typeDetail level on a directory entry.
channelData channel type.

Get a list of files from the current working directory on the remote FTP host.

Returns:
String array for the files in the directory.
Parameters:
pathName to get details for.
typeDetail level on a directory entry.
channelData channel type.
PTCPSocket* PFTPClient::GetFile ( const PString filename,
DataChannelType  channel = Passive 
)

Begin retreiving a file from the remote FTP server.

The second parameter indicates that the transfer is on a normal or passive data channel. In short, a normal transfer the server connects to the client and in passive mode the client connects to the server.

Returns:
Socket to read data from, or NULL if an error occurred.
Parameters:
filenameName of file to get
channelData channel type.

Get status information for the file path specified.

Returns:
String giving file status.
Parameters:
pathPath to get status for.
channelData channel type.

Get the type of the remote FTP server system, eg Unix, WindowsNT etc.

Returns:
String for the type of system.
PTCPSocket* PFTPClient::GetURL ( const PURL url,
RepresentationType  type,
DataChannelType  channel = Passive 
)

Begin retreiving a file from the remote FTP server.

The second parameter indicates that the transfer is on a normal or passive data channel. In short, a normal transfer the server connects to the client and in passive mode the client connects to the server.

Returns:
Socket to read data from, or NULL if an error occurred.
Parameters:
urlURL of file to get
typeType of transfer (text/binary)
channelData channel type.
PBoolean PFTPClient::LogIn ( const PString username,
const PString password 
)

Log in to the remote host for FTP.

Returns:
true if the log in was successfull.
Parameters:
usernameUser name for FTP log in.
passwordPassword for the specified user name.
PTCPSocket* PFTPClient::NormalClientTransfer ( Commands  cmd,
const PString args 
) [protected]
virtual PBoolean PFTPClient::OnOpen ( ) [protected, virtual]

Call back to verify open succeeded in an PInternetProtocol class.

Reimplemented from PIndirectChannel.

bool PFTPClient::OpenHost ( const PString host,
WORD  port = DefaultPort 
)

Open host using TCP.

PTCPSocket* PFTPClient::PassiveClientTransfer ( Commands  cmd,
const PString args 
) [protected]
PTCPSocket* PFTPClient::PutFile ( const PString filename,
DataChannelType  channel = Passive 
)

Begin storing a file to the remote FTP server.

The second parameter indicates that the transfer is on a normal or passive data channel. In short, a normal transfer the server connects to the client and in passive mode the client connects to the server.

Returns:
Socket to write data to, or NULL if an error occurred.
Parameters:
filenameName of file to get
channelData channel type.

Set the transfer type.

Returns:
true if transfer type set.
Parameters:
typeRepresentationTypeof file to transfer

Member Data Documentation

WORD PFTPClient::remotePort [protected]

Port number on remote system.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines