[Ericsson AB]

2 FTP client

2.1 Introduction

The ftp client though located in the inets application is, at least currently, a stand alone application. No processes related to ftp will be started when starting the inets application, and ftp will not add children to the inets supervisor tree. Rather a ftp client is thought of as a short lived process created when ftp:open/1 is called, and hence can not be code upgraded in runtime.

2.2 Using the ftp client API

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> {ok, Pid} = ftp:open("erlang.org").
      {ok,<0.22.0>}
      2> ftp:user(Pid, "guest", "password").
      ok
      3> ftp:pwd(Pid).
      {ok, "/home/guest"}
      4> ftp:cd(Pid, "appl/examples").
      ok
      5> ftp:lpwd(Pid).
      {ok, "/home/fred"}.
      6> ftp:lcd(Pid, "/home/eproj/examples").
      ok
      7> ftp:recv(Pid, "appl.erl").
      ok
      8> ftp:close(Pid).
      ok
    

Copyright © 1991-2004 Ericsson AB