The program sample1 is called in this way: sample1
file1 file2
Name and transfer admission to the remote system are then queried in a dialog. For the program to run, the following directory must exist:
Windows: the working directory
%TMP%\ft
Unix systems: the working directory
$HOME/ft
The program transfers the file file1 asynchronously from the local system to remote system and stores it there under the name file2 in the HOME directory of the user or under the login name specified in the admission profile. The precondition for this is that the file to be sent, file1, is located in the same directory as the one in which the program is called. If a SIGINT signal is created by the user (e.g. by entering CTRL+C under Windows), file transfer is aborted, provided that it has not yet been completed.
The program is structured as follows:
Since the file is to be transferred asynchronously, a session is first opened with the function ft_open(), where
%TMP%\ft
(under Windows) resp.$HOME/ft
(under Unix systems) is permanently assigned as working directory.ft_open() returns a session number, which identifies the session and must be specified with further function calls.
The asynchronous file transfer is initiated with the ft_transfer() function, which returns the request ID for the request.
From now on, the program queries whether a SIGINT signal was created by the user. If so, the request is aborted with the ft_cancel() function.
As long as file transfer has not been terminated or aborted, the ft_reqstat() queries the status of the file transfer request.
If file transfer is completed or has been aborted, the request is marked as terminated with the ft_reqterm() function and the session closed with the ft_close() function.