FTP is the widely-used protocol to move files between machines and across the Internet.
The class Ftp
provides a stackable comms module which offers FTP support.
FTP is defined in the standards document RFC 959
This can be the bottom module on the stack..
The create function can be used to create an Ftp
module eg.
(create Ftp)
Once created, this module is tailored using its properties
and methods.
However, an Ftp module is often created in the process of
creating a comms stack by using the function
buildCommsStack.
An Ftp module supports the following properties:
| property name | property type | description |
|---|---|---|
host |
String | TCP/IP host name of the server
to connect to
|
port |
Integer | TCP/IP port of the server
to connect to -- Default value: 21
|
user |
String | name of user with which to logon to the FTP server |
password |
String | password of user with which to logon to the FTP server |
timeout |
Integer | command timeout (milliseconds) allowed for the FTP server to respond to commands |
localDir |
String | local directory used for files involved in the transfer -- on creation, this defaults to the current working directory |
log |
Log | a log for the POP3 connection |
errorClass |
Integer | class of Ftp-specific errors |
useDialup |
Object | if non-NIL then dialup networking is used and the local
IP address is determined from the current dialup connection
|
The Ftp module supports the following
methods. These are closely coupled to those identified in the
RFC 959 standard.
Most of the FTP commands return a String
value -- this is the data returne by the underlying FTP command.
| method name | description |
|---|---|
connect |
connect this module |
logon |
logon to the service using the configured user name and password |
type |
set the type of data transfer -- e.g. binary,
image, ascii, ebcdic
|
cd |
change to a different directory on the remote host |
up |
move up one level in the directory structure on the remote host |
pwd |
return the current working directory on the remote host |
lcd |
move to a different working directory on the local machine |
del |
delete a file on the remote host |
rmdir |
remove a directory on the remote host |
mkdir |
create a new directory on the remote host |
rename |
rename a file on the remote host |
put |
transfer a file from the local to the remote host |
putData |
transfer the data and store as a file on the remote host |
get |
get a file from the remote host and store locally |
getData |
get the data from a file on the remote host |
mput |
transfer all local files matching the supplied pattern to the remote host |
mget |
fetch all remote files matching the supplied pattern |
mdel |
delete all remote files matching the supplied pattern |
ls |
produce a directory listing on the remote host |
filenames |
list the names of all remote files matching the supplied pattern |
localFilenames |
list the names of all local files matching the supplied pattern |
system |
ask the remote host what sort of system it is |
site |
send down any site-specific parameters to the remote host |
stat |
request a status -- e.g. of the supplied file/directory |
noop |
perform a null operation on the remote host |
abort |
abort any current transfer |
quit |
quit from the service |
disconnect |
disconnect this module |
logonLogon to the service using the configured user name and password.
Arguments: none
Return type: String returned
by the server
typeSet the type of data transfer -- legal values are:
binary
image
text
ebcdic
Arguments:
| transferType | String |
Return type: String returned
by the server
cdChange to a different directory on the remote host.
Arguments:
| dir | String |
Return type: String returned
by the server
upMove up one level in the directory structure on the remote host.
Arguments: none
Return type: String returned
by the server
pwdReturn the current working directory on the remote host.
Arguments: none
Return type: String returned
by the server
lcdMove to a different working directory on the local machine.
NOTE: This only changes the directory used by the FTP module locally -- it does
not affect the process's working directory which is changed by the
changeDir command.
Arguments:
| dir | String |
Return type: String returned
by the server
delDelete a file on the remote host.
Arguments:
| filename | String |
Return type: String returned
by the server
rmdirRemove a directory on the remote host.
Arguments:
| dir | String |
Return type: String returned
by the server
mkdirCreate a new directory on the remote host.
Arguments:
| dir | String |
Return type: String returned
by the server
renameRename a file on the remote host.
Arguments:
| oldName | String |
| newName | String |
Return type: String returned
by the server
putTransfer a file from the local to the remote host.
Arguments:
| filename | String |
Return type: String returned
by the server
putDataTransfer the data and store as a file on the remote host.
Arguments:
| filename | String |
| data | Binary |
Return type: String returned
by the server
getGet a file from the remote host and store locally.
Arguments:
| filename | String |
Return type: String returned
by the server
getDataGet the data from a file on the remote host.
Arguments:
| filename | String |
Return type: Binary the data from the
remote file.
mputTransfer all local files matching the supplied pattern to the remote host.
Arguments:
| pattern | String |
Return type: List of
Strings returned
by the server
mgetFetch all remote files matching the supplied pattern.
Arguments:
| pattern | String |
Return type: List of
Strings returned
by the server
mdelDelete all remote files matching the supplied pattern.
Arguments:
| pattern | String |
Return type: List of
Strings returned
by the server
lsProduce a directory listing on the remote host.
Arguments:
| (optional) pattern | String |
Return type: String returned
by the server
filenamesList the names of all remote files matching the supplied pattern.
Arguments:
| (optional) pattern | String |
Return type: List of
Strings returned
by the server
systemAsk the remote host what sort of system it is.
Arguments: none
Return type: String returned
by the server
siteSend down any site-specific parameters to the remote host.
Arguments:
| params | String |
Return type: String returned
by the server
statRequest a status -- e.g. of the supplied file/directory.
Arguments:
| transferType | String |
Return type: String returned
by the server
noopPerform a null operation on the remote host.
Arguments: none
Return type: String returned
by the server
abortAbort any current transfer.
Arguments:
| transferType | String |
Return type: String returned
by the server
quitQuit from the service.
Arguments: none
Return type: String returned
by the server
| Contents | Index | Current topic: communications | Related topics: communications classes, objects |