ftp

A small (and very incomplete) FTP library

SYNOPSIS

(make <FTP-connection> ?options?)
(ftp-login f user pass)
(ftp-quit f)
(ftp-chdir f dir)
(ftp-pwd f)
(ftp-type f mode)
(ftp-help f)
(ftp-help f command)
(ftp-dir f)
(ftp-dir f args)
(ftp-get f file)
(ftp-put f file)
(ftp-display f file)

CLASS DESCRIPTION

Included with:
(require "ftp")

Inherits from:
<top>

Direct slots:
host contains the name of the host to connect to.

port specifies the port to use to establish the ftp connection. This slot is initialized by default to 21 by default (the standard ftp port).

echo is the name of a one parameter procedure used to display the messages sent by the ftp server. This slot is initialized to by default to the standard display procedure.

DESCRIPTION

This library is a first attempt to make the FTP protocol available from the STk interpreter. It is still very incomplete and has not been intensively tested. Any help to make the subset implemented conform to RFC 959 would be greatly appreciated.

The following procedure are implemented by the library:

(ftp-quit f)
close the connection f to the remote host and the associated files.

(ftp-chdir f dir)
changes the remote working directory on the f connection.

(ftp-pwd f)
returns the remote working directory on the f connection.

(ftp-type f mode)
set the file transfer type to mode on the f connection. Mode must be a one letter symbol such as 'a (for ASCII) or 'i (for image).

(ftp-help f)
(ftp-help f command)
prints help from the server connected to f on the standard output port.

(ftp-dir f)
(ftp-dir f args)
gives the list of files in the current remote directory. If args is specified it is passed to the ftp server.

(ftp-get f file)
retrieves file on the remote server.

(ftp-put f file)
stores file on the remote server.

(ftp-display f file)
prints on the standard output port the content of the file file located the remote server.

All these procedures return a boolean value which indicate if the requested operation succeeded or not.

EXAMPLE

Hereafter is a simple session which prints the content of the /pub directory and gets the last release of STk on the kaolin workstation:
(define f (make <FTP-connection> :host "kaolin.unice.fr"))
(when (ftp-login  f "anonymous" "eg@unice.fr")
   (ftp-chdir f "/pub")
   (ftp-dir f "-lsa")
   (ftp-get f "STk.tar.gz")
   (ftp-quit f))

Back to the STk main page