Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Internet Protocols Module Reference Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

RWFtpClient

Module:  Internet Protocols Module   Package:  FTP


Does not inherit

Local Index

Members

Header File

#include <rw/ftp/RWFtpClient.h>

Description

RWFtpClient provides low-level access to the FTP client-side protocol. In most cases, the method names parallel the names of the protocol actions. The RWFtpClient class maintains a finite state machine to enforce correct FTP protocol action ordering. In the case of misordered method invocation, an RWProtocolClientCmdSequenceError exception is thrown. All client methods return redeemable RWTIOUResults for a particular type of RWFtpReply. RWFtpReply and its subclasses, RWFtpPwdReply and RWFtpDataReply, contain an encapsulation of the standard FTP protocol reply messages. Specific subclasses of RWFtpReply return additional information specific to those types of protocol replies.

RWFtpClient objects are lightweight. They are implemented using the interface-implementation idiom. The RWFtpClient itself is a handle to an implementation that performs the protocol interaction.

Methods that construct data transfer connections, such as retr(), stor(), stou(), list() and nlst(), take a port argument. The port argument controls how the data connection is constructed. Its default is 0.

Value of port Data Connection Socket Port

-1

Client -> Server

Local port - Auto selected

0 (default)

Server -> Client

Local port - Auto selected

>0

Server -> Client

Local port - Value of port

If the port argument is 0, RWFtpClient selects a local port using an internal algorithm. It then negotiates a server-to-client data connection using the internal PORT protocol command, which is one of the FTP protocol commands. If port is greater than 0, RWFtpClient negotiates a server-to-client data connection to the specified port using the internal PORT protocol command. If the value of port is -1, RWFtpClient negotiates a client-to-server data connection to the address and port provided by the FTP server by using the internal PASV protocol command.

The direction of data connection is independent of direction of the data transfer. If you have a firewall, you may need to use the client-server connection strategy. It is not supported by all FTP servers, though. For most applications, the default value of 0 is best.

Example

Public Constructor

RWFtpClient();

Public Member Functions

RWTIOUResult<RWFtpDataReply>
appe(const RWCString& fspec, int port = 0);
RWTIOUResult<RWFtpReply>
cdup();
RWTIOUResult<RWFtpReply>
connect(const RWSockAddrBase& address); 
RWTIOUResult<RWFtpReply>
cwd(const RWCString& dir);
RWTIOUResult<RWFtpReply>
dataAbort();
RWTIOUResult<RWFtpReply>
dataClose();
RWTIOUResult<RWFtpReply>
dataUrgentAbort();

NOTE -- Use of this command is dangerous because some servers abort the entire session if they receive this action after they have finished sending all their data. Try using the in-band version, dataAbort(), first.
RWTIOUResult<RWFtpReply>
dele(const RWCString& fspec);
RWTIOUResult<RWFtpReply>
exec(const RWCString& cmdarg);
unsigned long
getTimeout(void) const;
RWTIOUResult<RWFtpReply>
help(const RWCString& specificCmd="");
RWTIOUResult<RWFtpDataReply>
list(const RWCString& path="", int port=0);
RWTIOUResult<RWFtpReply>
mkd(const RWCString& fspec);
RWTIOUResult<RWFtpDataReply>
nlst(const RWCString& path="", int port=0);
RWTIOUResult<RWFtpReply>
noop();
RWTIOUResult<RWFtpReply>
pass(const RWCString& pass);
RWTIOUResult<RWFtpPwdReply>
pwd();
RWTIOUResult<RWFtpReply>
quit();
RWTIOUResult<RWFtpReply>
rein();
RWTIOUResult<RWFtpDataReply>
retr(const RWCString& fspec, int port=0);
RWTIOUResult<RWFtpReply>
rmd(const RWCString& fspec);
RWTIOUResult<RWFtpReply>
rnfr(const RWCString& fspec);
RWTIOUResult<RWFtpReply>
rnto(const RWCString& fspec);
void
setTimeout(unsigned long timeout);
RWTIOUResult<RWFtpReply>
site(const RWCString& specificSiteInfo="");
RWTIOUResult<RWFtpReply>
syst();
RWTIOUResult<RWFtpDataReply>
stor(const RWCString& fspec, int port=0);
RWTIOUResult<RWFtpDataReply>
stou(const RWCString& fileName, int port=0);
RWTIOUResult<RWFtpReply>
type(const RWCString& t);
RWTIOUResult<RWFtpReply>
user(const RWCString& user);


Previous fileTop of DocumentContentsIndex pageNext file

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.