This module implements a client for file transfer
according to a subset of the File Transfer Protocol (FTP), see
As from
An FTP client can be started in two ways. One is using the
For a simple example of an FTP session, see
In addition to the ordinary functions for receiving and sending
files (see
A set of functions is provvided for sending and receiving
contiguous parts of a file to be stored in a remote file. For send,
see
The return values of the following functions depend
much on the implementation of the FTP server at the remote
host. In particular, the results from
The FTP client can be started and stopped dynamically in runtime by
calling the
The available configuration options are as follows:
Host =
Port =
Default is
Mode =
Default is
Verbose =
Determines if the FTP communication is to be verbose or not.
Default is
Debug =
Debugging using the dbg toolkit.
Default is
IpFamily =
With
Default is
Timeout =
Connection time-out.
Default is
DTimeout =
Data connect time-out. The time the client waits for the server to connect to the data socket.
Default is
Progress =
Default is
Option
Before a file is transferred, the following call is
made to indicate the start of the file transfer and how large
the file is. The return value of the callback function
is to be a new value for the
Every time a chunk of bytes is transferred the following call is made:
At the end of the file the following call is made to indicate the end of the transfer:
The callback function is to be defined as follows:
For remote files,
The callback is made by a middleman process, hence the
file transfer is not affected by the code in the progress
callback function. If the callback crashes, this is
detected by the FTP connection process, which then prints an
info-report and goes on as if the progress option was set
to
The file transfer type is set to the default of the FTP server when the session is opened. This is usually ASCCI mode.
The current local working directory (compare
The return value
The following type definitions are used by more than one function in the FTP client API:
Sets the account for an operation, if needed.
Transfers the file
Transfers the binary
Transfers the chunk
For some errors, for example, file system full, it is
necessary to call
Starts the transfer of chunks for appending to the file
Stops transfer of chunks for appending to the remote server.
The file at the remote server, specified in the call to
Changes the working directory at the remote server to
Ends an FTP session, created using function
Deletes the file
Given an error return value
Changes the working directory to
Returns the current working directory at the local client.
Returns a list of files in long format.
The format of
Creates the directory
Returns a list of files in short format.
The format of
Starts a standalone FTP client process
(without the
If option
The options
A session opened in this way is closed using function
Returns the current working directory at the remote server.
Transfers the file
If the file write fails (for example,
Transfers the file
Starts transfer of the file
Receives a chunk of the remote file (
Renames
Removes directory
Transfers the file
Transfers the binary
Transfers the chunk
For some errors, for example, file system full, it is
necessary to to call
Starts transfer of chunks into the file
Stops transfer of chunks to the remote server. The file at the
remote server, specified in the call to
Sets the file transfer type to
Performs login of
Performs login of
The telnet end of line characters, from the FTP protocol definition, CRLF, for example, "\\r\\n" has been removed.
Sends an arbitrary FTP command and returns verbatim a list of the lines sent back by the FTP server. This function is intended to give application accesses to FTP commands that are server-specific or that cannot be provided by this FTP client.
FTP commands requiring a data connection cannot be successfully issued with this function.
The possible error reasons and the corresponding diagnostic strings
returned by
Synchronization error during chunk sending according to one of the following:
The session is closed.
Connection to the remote server is prematurely closed.
Host is not found, FTP server is not found, or connection is rejected by FTP server.
User is not logged in.
Term is not a binary.
No such file or directory, or directory already exists, or permission denied.
No such type.
Invalid username or password.
Insufficient storage space in system [452].
Exceeded storage allocation (for current directory or dataset) [552].
Filename not allowed [553].