1 Introduction

* Overview
CL-FTP is a library which provides FTP client functionality to a Common Lisp
program. CL-FTP uses the USOCKET package for network sockets and the
SPLIT-SEQUENCE package for some parsing needs.
* Examples
#+begin_src lisp
(with-ftp-connection (conn :hostname "foo")
(retrieve-file conn "bar" "baz"))
#+end_src
Further examples should be included with your copy of this software. See
simple-client.lisp for a simple FTP client written with CL-FTP.
* #'RETRIEVE-FILE / #'STORE-FILE hang or don't work
* Short answer :: Use passive FTP.
* Long answer :: FTP is something of a weird protocol, and this tends to trip
people up—FTP opens up two connections, one for commands, and one for data
(file transfers). The data channel can be opened in two different ways: in
"active" mode (the default), the client tells the server "hey, connect to me
on port X", and then the server actually opens the connection to the client;
in "passive" mode, the client connects to the server.
As you might imagine, active mode does not play well with NAT or firewalls,
and this is usually the problem when commands work, but files fail to
download. Most likely, including =:passive-ftp-p t= in your
=WITH-FTP-CONNECTION= or =(make-instance 'ftp-connection)= form will get you
going.
* License
This software, and documentation, is copyright various authors. Redistribution
and modification is permitted under a MIT-style license. See the LICENSE file
for more details.

5.1.1 Macros

Opens and ensures proper close of an FTP connection. Binds connection-variable to the FTP-CONNECTION object in the scope of body. Arguments are similar to that of the initargs for the class FTP-CONNECTION.

Opens a data transfer socket in the scope of body, using the given FTP connection and executing the given FTP command-string. If :REST is specified, then the FTP "REST" command will be sent with the value of the argument. :TYPE may be :BINARY or :ASCII. Closes the transfer-socket upon dynamic exit of body.

Attempts to connect to the server using the information provided by connection-variable. If connection-variable represents an existing connection, then that connection will be closed and a new one established.

Receives a response from the FTP server. Returns a list of strings as the first value and the response code as the second. If :BLOCK is T, then will block until response received. Otherwise return NIL if nothing is available currently.

Retrieves a list of the form (type name) where type is :DIRECTORY or :FILE and name is a filename in the given directory named by pathname. Note: this is implemented by attempting CWDs, and may break if the FTP server does strange things.