1 URLs and HTTP
2 URI Codec: Encoding and Decoding URIs
3 FTP: Client Downloading
4 Send URL: Opening a Web Browser
5 SMTP: Sending E-Mail
6 sendmail: Sending E-Mail
7 Headers: Parsing and Constructing
8 IMAP: Reading Mail
9 POP3: Reading Mail
10 MIME: Decoding Internet Data
11 Base 64: Encoding and Decoding
12 Quoted-Printable: Encoding and Decoding
13 DNS: Domain Name Service Queries
14 NNTP: Newsgroup Protocol
15 TCP: Unit and Signature
16 TCP Redirect: tcp^ via Channels
17 SSL Unit: tcp^ via SSL
18 CGI Scripts
19 Cookie: HTTP Client Storage
Bibliography
Index
On this page:
3.1 Functions
ftp-connection?
ftp-establish-connection
ftp-close-connection
ftp-cd
ftp-directory-list
ftp-make-file-seconds
ftp-download-file
3.2 FTP Unit
ftp@
3.3 FTP Signature
ftp^
Version: 4.0.2

 

3 FTP: Client Downloading

 (require net/ftp)

The net/ftp library provides utilities for FTP client operations.

The library was written by Micah Flatt.

3.1 Functions

(ftp-connection? v)  boolean?

  v : any/c

Returns #t if v represents an FTP connection as returned by ftp-establish-connection, #f otherwise.

(ftp-establish-connection

 

server

 

 

 

 

 

 

port-no

 

 

 

 

 

 

user

 

 

 

 

 

 

passwd)

 

 

ftp-connection?

  server : string?

  port-no : (integer-in 0 65535)

  user : string?

  passwd : string?

Establishes an FTP connection with the given server using the supplied username and password.

The username and password strings are encoded to bytes using the current locale’s encoding.

(ftp-close-connection ftp-conn)  void?

  ftp-conn : ftp-connection?

Closes an FTP connection.

(ftp-cd ftp-conn new-dir)  void?

  ftp-conn : ftp-connection?

  new-dir : string?

Changes the current directory on the FTP server to new-dir. The new-dir argument is not interpreted at all, but simply passed on to the server (encoded using the current locale’s encoding); it must not contain a newline.

(ftp-directory-list ftp-conn)

 

 

(listof (list/c (one-of/c "-" "d" "l")

                string?

                string?))

  ftp-conn : ftp-connection?

Returns a list of files and directories in the current directory of the server, assuming that the server provides directory information in the quasi-standard Unix format.

Each file or directory is represented by a list of three strings. The first string is either "-", "d", or "l", depending on whether the items is a file, directory, or link, respectively. The second item is the file’s date; to convert this value to seconds consistent with file-seconds, pass the date string to ftp-make-file-seconds, below. The third string is the name of the file or directory.

All strings are decoded from bytes using the current locale’s encoding.

(ftp-make-file-seconds ftp-date)  exact-integer?

  ftp-date : string?

Takes a date string produced by ftp-directory-list and converts it to seconds (which can be used with seconds->date).

(ftp-download-file ftp-conn local-dir file)  void?

  ftp-conn : ftp-connection?

  local-dir : path-string?

  file : string?

Downloads file from the server’s current directory and puts it in local-dir using the same name. If the file already exists in the local directory, it is replaced, but only after the transfer succeeds (i.e., the file is first downloaded to a temporary file, then moved into place on success).

3.2 FTP Unit

 (require net/ftp-unit)

ftp@ : unit?

Imports nothing, exports ftp^.

3.3 FTP Signature

 (require net/ftp-sig)

ftp^ : signature

Includes everything exported by the net/ftp module.