Ftp client processes exist only when you use them. When you open a ftp connection a client process will be spawned and added as a dynamic child to the ftp supervisor in the inets supervision tree. When you close the connection the client process will be terminated. Only the process that created the ftp-connection will be permitted to use it, and if that process dies the connection process will terminate.
The client supports ipv6 as long as the underlying mechanisms also do so.
The following is a simple example of an ftp session, where
the user guest
with password password
logs on to
the remote host erlang.org
, and where the file
appl.erl
is transferred from the remote to the local
host. When the session is opened, the current directory at
the remote host is /home/guest
, and /home/fred
at the local host. Before transferring the file, the current
local directory is changed to /home/eproj/examples
, and
the remote directory is set to
/home/guest/appl/examples
.
1> application:start(inets). ok 2> {ok, Pid} = ftp:open("erlang.org"). {ok,<0.22.0>} 3> ftp:user(Pid, "guest", "password"). ok 4> ftp:pwd(Pid). {ok, "/home/guest"} 5> ftp:cd(Pid, "appl/examples"). ok 6> ftp:lpwd(Pid). {ok, "/home/fred"}. 7> ftp:lcd(Pid, "/home/eproj/examples"). ok 8> ftp:recv(Pid, "appl.erl"). ok 9> ftp:close(Pid). ok