Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Sample 2: Several file transfer requests with follow-up processing

&pagelevel(3)&pagelevel

The program sample2 is called in this way:
sample2 file1 [file2] [file3] [file4]
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 fetches each of the files specified asynchronously from the HOME directory of the user of from the login name specified in the admission profile in the remote system. In the local system, the file is stored in the directory with the same name as the one from which the program was called. If a file of this name already exists there then it is overwritten.
If file transfer has been completed successfully, the file is printed out in the local system. If the file was not transferred, the user is sent a message. If a SIGINT signal is created by the user (e.g. by entering CTRL+C under Windows), while the file has not yet been transferred, the current file transfer request is aborted. No subsequent file transfer requests are initiated.
The program is structured as follows:

  • First, a session is first opened with the function ft_open(), where %TMP%\ft (Windows systems) or $HOME/ft (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 following procedure is repeated for all file to be transferred:

    • The asynchronous file transfer is initiated with the ft_transfer() function.

    • 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, if the status is "Waiting" or "Running".

    • As long a the file transfer has not been completed, the ft_reqstat() function queries the status of the file transfer request.

    • If the status of the request is "Terminated", follow-up processing is started, i.e.the file transferred to the local system is printed.

    • If the status of the request is aborted "Aborted", a message is output.

    • In all cases, the file transfer request is marked as terminated with the ft_reqterm().

  • The session is closed with the ft_close() function when all the file specified have been processed.