The
Starting from inets version 4.4.1 the ftp
client will always try to use passive ftp mode and only resort
to active ftp mode if this fails. There is a start option
There are two ways to start an ftp client. 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
There is also a set of functions for sending and receiving
contiguous parts of a file to be stored in a remote file (for send
see
The particular return values of the functions below depend very
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 Inets application API
Below follows a description of the available configuration options.
Host =
Port =
Default is 21.
Mode =
Default is
Verbose =
This determines if the FTP communication should be verbose or not.
Default is
Debug =
Debugging using the dbg toolkit.
Default is
IpFamily =
With
Default is
Timeout =
Connection timeout.
Default is 60000 (milliseconds).
DTimeout =
Data Connect timeout. The time the client will wait for the server to connect to the data socket.
Default is infinity.
Progress =
CBModule =
InitProgress =
Default is
The progress option is intended to be used by applications that want to create some type of progress report such as a progress bar in a GUI. The default value for the progress option is ignore e.i. the option is not used. When the progress option is specified the following will happen when ftp:send/[3,4] or ftp:recv/[3,4] are called.
Before a file is transfered the following call will be made to indicate the start of the file transfer and how big the file is. The return value of the callback function should be a new value for the UserProgressTerm that will bu used as input next time the callback function is called.
Every time a chunk of bytes is transfered the following call will be made:
At the end of the file the following call will be made to indicate the end of the transfer.
The callback function should be defined as
Alas for remote files it is not possible for ftp to determine the
file size in a platform independent way. In this case the size
will be
The callback is made by a middleman process, hence the file transfer will not be affected by the code in the progress callback function. If the callback should crash this will be detected by the ftp connection process that will print an info-report and then go one as if the progress option was set to ignore.
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 (cf.
The return value
Here follows type definitions that are used by more than one function in the FTP client API.
If an account is needed for an operation set the account with this operation.
Transfers the file
Transfers the binary
Transfer the chunk
Note that for some errors, e.g. file system full, it is
necessary to to call
Start 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 the
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
This function is used to start a standalone ftp client process
(without the inets service framework) and
open a session with the FTP server at
If the option
A session opened in this way, is closed using the
Returns the current working directory at the remote server.
Returns the current working directory at the remote server.
Transfer the file
If the file write fails
(e.g. enospc), then the command is aborted and
Transfers the file
Start transfer of the file
Receive a chunk of the remote file (
Renames
Removes directory
Transfers the file
Transfers the binary
Transfer the chunk
Note that for some errors, e.g. file system full, it is
necessary to to call
Start 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
Sends an arbitrary FTP command and returns verbatimly a list of the lines sent back by the FTP server. This functions is intended to give an application accesses to FTP commands that are server specific or that may not be provided by this FTP client.
FTP commands that require a data connection can not be successfully issued with this function.
The possible error reasons and the corresponding diagnostic strings
returned by
Synchronisation error during chunk sending.
A call has been made to
The session has been closed.
Connection to remote server prematurely closed.
Host not found, FTP server not found, or connection rejected by FTP server.
User not logged in.
Term is not a binary.
No such file or directory, or directory already exists, or permission denied.
No such type.
User name or password not valid.
Insufficient storage space in system [452].
Exceeded storage allocation (for current directory or dataset) [552].
File name not allowed [553].
file, filename, J. Postel and J. Reynolds: File Transfer Protocol (RFC 959).