Carapace

FTP - File Transfer Protocol

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

Ftp Stack Requirements

This can be the bottom module on the stack..

Ftp Creation

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.

Ftp Properties

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

Ftp Methods

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


logon

Logon to the service using the configured user name and password.

Arguments: none

Return type: String returned by the server


type

Set the type of data transfer -- legal values are:

Arguments:

transferTypeString

Return type: String returned by the server


cd

Change to a different directory on the remote host.

Arguments:

dirString

Return type: String returned by the server


up

Move up one level in the directory structure on the remote host.

Arguments: none

Return type: String returned by the server


pwd

Return the current working directory on the remote host.

Arguments: none

Return type: String returned by the server


lcd

Move 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:

dirString

Return type: String returned by the server


del

Delete a file on the remote host.

Arguments:

filenameString

Return type: String returned by the server


rmdir

Remove a directory on the remote host.

Arguments:

dirString

Return type: String returned by the server


mkdir

Create a new directory on the remote host.

Arguments:

dirString

Return type: String returned by the server


rename

Rename a file on the remote host.

Arguments:

oldNameString
newNameString

Return type: String returned by the server


put

Transfer a file from the local to the remote host.

Arguments:

filenameString

Return type: String returned by the server


putData

Transfer the data and store as a file on the remote host.

Arguments:

filenameString
dataBinary

Return type: String returned by the server


get

Get a file from the remote host and store locally.

Arguments:

filenameString

Return type: String returned by the server


getData

Get the data from a file on the remote host.

Arguments:

filenameString

Return type: Binary the data from the remote file.


mput

Transfer all local files matching the supplied pattern to the remote host.

Arguments:

patternString

Return type: List of Strings returned by the server


mget

Fetch all remote files matching the supplied pattern.

Arguments:

patternString

Return type: List of Strings returned by the server


mdel

Delete all remote files matching the supplied pattern.

Arguments:

patternString

Return type: List of Strings returned by the server


ls

Produce a directory listing on the remote host.

Arguments:

(optional) patternString

Return type: String returned by the server


filenames

List the names of all remote files matching the supplied pattern.

Arguments:

(optional) patternString

Return type: List of Strings returned by the server


system

Ask the remote host what sort of system it is.

Arguments: none

Return type: String returned by the server


site

Send down any site-specific parameters to the remote host.

Arguments:

paramsString

Return type: String returned by the server


stat

Request a status -- e.g. of the supplied file/directory.

Arguments:

transferTypeString

Return type: String returned by the server


noop

Perform a null operation on the remote host.

Arguments: none

Return type: String returned by the server


abort

Abort any current transfer.

Arguments:

transferTypeString

Return type: String returned by the server


quit

Quit from the service.

Arguments: none

Return type: String returned by the server


Contents Index Current topic: communications Related topics: communications classes, objects