~statik/ubuntu/maverick/erlang/erlang-merge-testing

« back to all changes in this revision

Viewing changes to lib/inets/doc/src/ftp_client.xml

  • Committer: Bazaar Package Importer
  • Author(s): Sergei Golovan
  • Date: 2009-05-01 10:14:38 UTC
  • mfrom: (3.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20090501101438-6qlr6rsdxgyzrg2z
Tags: 1:13.b-dfsg-2
* Cleaned up patches: removed unneeded patch which helped to support
  different SCTP library versions, made sure that changes for m68k
  architecture applied only when building on this architecture.
* Removed duplicated information from binary packages descriptions.
* Don't require libsctp-dev build-dependency on solaris-i386 architecture
  which allows to build Erlang on Nexenta (thanks to Tim Spriggs for
  the suggestion).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="latin1" ?>
 
2
<!DOCTYPE chapter SYSTEM "chapter.dtd">
 
3
 
 
4
<chapter>
 
5
  <header>
 
6
    <copyright>
 
7
      <year>2004</year><year>2009</year>
 
8
      <holder>Ericsson AB. All Rights Reserved.</holder>
 
9
    </copyright>
 
10
    <legalnotice>
 
11
      The contents of this file are subject to the Erlang Public License,
 
12
      Version 1.1, (the "License"); you may not use this file except in
 
13
      compliance with the License. You should have received a copy of the
 
14
      Erlang Public License along with this software. If not, it can be
 
15
      retrieved online at http://www.erlang.org/.
 
16
    
 
17
      Software distributed under the License is distributed on an "AS IS"
 
18
      basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 
19
      the License for the specific language governing rights and limitations
 
20
      under the License.
 
21
    
 
22
    </legalnotice>
 
23
 
 
24
    <title>FTP Client</title>
 
25
    <prepared>Ingela Anderton Andin</prepared>
 
26
    <responsible></responsible>
 
27
    <docno></docno>
 
28
    <approved></approved>
 
29
    <checked></checked>
 
30
    <date></date>
 
31
    <rev></rev>
 
32
    <file></file>
 
33
  </header>
 
34
 
 
35
  <section>
 
36
    <title>Introduction</title>
 
37
 
 
38
    <p>Ftp clients are consider to be rather temporary and are
 
39
      for that reason only started and stopped during
 
40
      runtime and can not be started at application startup.
 
41
      Due to the design of FTP client API, letting some
 
42
      functions return intermediate results, only the process
 
43
      that started the ftp client will be able to access it in
 
44
      order to preserve sane semantics. (This could be solved
 
45
      by changing the API and using the concept of a controlling
 
46
      process more in line with other OTP applications, but
 
47
      that is perhaps something for the future.) 
 
48
      If the process that started the ftp session 
 
49
      dies the ftp client process will terminate.</p>
 
50
 
 
51
    <p>The client supports ipv6 as long as the underlying mechanisms
 
52
      also do so. </p>
 
53
 
 
54
    </section>
 
55
 
 
56
  <section>
 
57
    <title>Using the FTP Client API</title>
 
58
    <p>The following is a simple example of an ftp session, where
 
59
      the user <c>guest</c> with password <c>password</c> logs on to
 
60
      the remote host <c>erlang.org</c>, and where the file
 
61
      <c>appl.erl</c> is transferred from the remote to the local
 
62
      host.  When the session is opened, the current directory at
 
63
      the remote host is <c>/home/guest</c>, and <c>/home/fred</c>
 
64
      at the local host. Before transferring the file, the current
 
65
      local directory is changed to <c>/home/eproj/examples</c>, and
 
66
      the remote directory is set to
 
67
      <c>/home/guest/appl/examples</c>.</p>
 
68
    <code type="erl"><![CDATA[
 
69
      1> inets:start().
 
70
      ok
 
71
      2> {ok, Pid} = inets:start(ftpc, [{host, "erlang.org"}]).
 
72
      {ok,<0.22.0>}
 
73
      3> ftp:user(Pid, "guest", "password").
 
74
      ok
 
75
      4> ftp:pwd(Pid).
 
76
      {ok, "/home/guest"}
 
77
      5> ftp:cd(Pid, "appl/examples").
 
78
      ok
 
79
      6> ftp:lpwd(Pid).
 
80
      {ok, "/home/fred"}.
 
81
      7> ftp:lcd(Pid, "/home/eproj/examples").
 
82
      ok
 
83
      8> ftp:recv(Pid, "appl.erl").
 
84
      ok
 
85
      9> inets:stop(ftpc, Pid).
 
86
      ok
 
87
    ]]></code>
 
88
  </section>
 
89
</chapter>
 
90
 
 
91