Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

RWIFtpClient



Module

Networking Tools: Thread-hot Internet Classes (int library)

Data Type and Member Function Indexes
(exclusive of constructors and destructors)

Member Functions

Synopsis

#include <rw/toolpro/ftp.h>
RWIFtpClient client;

Required Libraries

thr, net, int, tls (and possibly std)

Description

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

RWIFtpClient objects are lightweight. They are implemented using the interface-implementation pattern. The RWIFtpClient itself is really 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 default argument port. The port argument controls how the data connection is constructed.

 
Value of portData ConnectionSocket 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, which is the default, then RWIFtpClient selects a local port using an internal algorithm and 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, then RWIFtpClient negotiates a server-to-client data connection to the specified port using the internal PORT protocol command. If the value of port is -1, RWIFtpClient negotiates a client-to-server data connection to the address and port provided by the FTP server by using the internal PASV protocol command.

Note that the direction of data connection is not related to that of data transfer, it is purely a connection construction issue. Often users with firewalls may need to use the Client-Server connection strategy. However, this is not supported by all FTP servers. For most users the default value of 0 is best.

Example

Public Constructors

RWIFtpClient();

Public Member Functions

RWIOUResult<RWIFtpReply>
cdup();
RWIOUResult<RWIFtpReply>
connect(const RWCString& host, int port=21); 
RWIOUResult<RWIFtpReply>
cwd(const RWCString& dir);
RWIOUResult<RWIFtpReply>
dataAbort();
RWIOUResult<RWIFtpReply>
dataClose();
RWIOUResult<RWIFtpReply>
dataUrgentAbort();

NOTE: Use of this command is somewhat 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.
RWIOUResult<RWIFtpReply>
dele(const RWCString& fspec);
RWIOUResult<RWIFtpReply>
exec(const RWCString& cmdarg);
RWIOUResult<RWIFtpReply>
help(const RWCString& specificCmd="");
RWIOUResult<RWIFtpDataReply>
list(const RWCString& path="", int port=0);
RWIOUResult<RWIFtpReply>
mkd(const RWCString& fspec);
RWIOUResult<RWIFtpDataReply>
nlst(const RWCString& path="", int port=0);
RWIOUResult<RWIFtpReply>
noop();
RWIOUResult<RWIFtpReply>
pass(const RWCString& pass);
RWIOUResult<RWIFtpPwdReply>
pwd();
RWIOUResult<RWIFtpReply>
quit();
RWIOUResult<RWIFtpReply>
rein();
RWIOUResult<RWIFtpDataReply>
retr(const RWCString& fspec, int port=0);
RWIOUResult<RWIFtpReply>
rmd(const RWCString& fspec);
RWIOUResult<RWIFtpReply>
rnfr(const RWCString& fspec);
RWIOUResult<RWIFtpReply>
rnto(const RWCString& fspec);
RWIOUResult<RWIFtpReply>
site(const RWCString& specificSiteInfo="");
RWIOUResult<RWIFtpReply>
syst();
RWIOUResult<RWIFtpDataReply>
stor(const RWCString& fspec, int port=0);
RWIOUResult<RWIFtpDataReply>
stou(const RWCString& fileName, int port=0);
RWIOUResult<RWIFtpReply>
type(const RWCString& t);
RWIOUResult<RWIFtpReply>
user(const RWCString& user);


Previous fileTop of DocumentContentsIndexNext file

©Copyright 2000, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.