Sophie

Sophie

distrib > Fedora > 17 > i386 > media > updates > by-pkgid > 675c8c8167236dfcf8d66da674f931e8 > files > 776

erlang-doc-R15B-03.3.fc17.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns:fn="http://www.w3.org/2005/02/xpath-functions">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../../../doc/otp_doc.css" type="text/css">
<title>Erlang -- ftp</title>
</head>
<body bgcolor="white" text="#000000" link="#0000ff" vlink="#ff00ff" alink="#ff0000"><div id="container">
<script id="js" type="text/javascript" language="JavaScript" src="../../../../doc/js/flipmenu/flipmenu.js"></script><script id="js2" type="text/javascript" src="../../../../doc/js/erlresolvelinks.js"></script><script language="JavaScript" type="text/javascript">
            <!--
              function getWinHeight() {
                var myHeight = 0;
                if( typeof( window.innerHeight ) == 'number' ) {
                  //Non-IE
                  myHeight = window.innerHeight;
                } else if( document.documentElement && ( document.documentElement.clientWidth ||
                                                         document.documentElement.clientHeight ) ) {
                  //IE 6+ in 'standards compliant mode'
                  myHeight = document.documentElement.clientHeight;
                } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
                  //IE 4 compatible
                  myHeight = document.body.clientHeight;
                }
                return myHeight;
              }

              function setscrollpos() {
                var objf=document.getElementById('loadscrollpos');
                 document.getElementById("leftnav").scrollTop = objf.offsetTop - getWinHeight()/2;
              }

              function addEvent(obj, evType, fn){
                if (obj.addEventListener){
                obj.addEventListener(evType, fn, true);
                return true;
              } else if (obj.attachEvent){
                var r = obj.attachEvent("on"+evType, fn);
                return r;
              } else {
                return false;
              }
             }

             addEvent(window, 'load', setscrollpos);

             //--></script><div id="leftnav"><div class="innertube">
<img alt="Erlang logo" src="../../../../doc/erlang-logo.png"><br><small><a href="users_guide.html">User's Guide</a><br><a href="index.html">Reference Manual</a><br><a href="release_notes.html">Release Notes</a><br><a href="../pdf/inets-5.9.2.pdf">PDF</a><br><a href="../../../../doc/index.html">Top</a></small><p><strong>inets</strong><br><strong>Reference Manual</strong><br><small>Version 5.9.2</small></p>
<br><a href="javascript:openAllFlips()">Expand All</a><br><a href="javascript:closeAllFlips()">Contract All</a><p><small><strong>Table of Contents</strong></small></p>
<ul class="flipMenu">
<li id="no" title="inets " expanded="false">inets<ul>
<li><a href="inets.html">
                  Top of manual page
                </a></li>
<li title="services-0"><a href="inets.html#services-0">services/0</a></li>
<li title="services_info-0"><a href="inets.html#services_info-0">services_info/0</a></li>
<li title="service_names-0"><a href="inets.html#service_names-0">service_names/0</a></li>
<li title="start-0"><a href="inets.html#start-0">start/0</a></li>
<li title="start-1"><a href="inets.html#start-1">start/1</a></li>
<li title="stop-0"><a href="inets.html#stop-0">stop/0</a></li>
<li title="start-2"><a href="inets.html#start-2">start/2</a></li>
<li title="start-3"><a href="inets.html#start-3">start/3</a></li>
<li title="stop-2"><a href="inets.html#stop-2">stop/2</a></li>
</ul>
</li>
<li id="loadscrollpos" title="ftp " expanded="true">ftp<ul>
<li><a href="ftp.html">
                  Top of manual page
                </a></li>
<li title="account-2"><a href="ftp.html#account-2">account/2</a></li>
<li title="append-2"><a href="ftp.html#append-2">append/2</a></li>
<li title="append-3"><a href="ftp.html#append-3">append/3</a></li>
<li title="append_bin-3"><a href="ftp.html#append_bin-3">append_bin/3</a></li>
<li title="append_chunk-2"><a href="ftp.html#append_chunk-2">append_chunk/2</a></li>
<li title="append_chunk_start-2"><a href="ftp.html#append_chunk_start-2">append_chunk_start/2</a></li>
<li title="append_chunk_end-1"><a href="ftp.html#append_chunk_end-1">append_chunk_end/1</a></li>
<li title="cd-2"><a href="ftp.html#cd-2">cd/2</a></li>
<li title="close-1"><a href="ftp.html#close-1">close/1</a></li>
<li title="delete-2"><a href="ftp.html#delete-2">delete/2</a></li>
<li title="formaterror-1"><a href="ftp.html#formaterror-1">formaterror/1</a></li>
<li title="lcd-2"><a href="ftp.html#lcd-2">lcd/2</a></li>
<li title="lpwd-1"><a href="ftp.html#lpwd-1">lpwd/1</a></li>
<li title="ls-1"><a href="ftp.html#ls-1">ls/1</a></li>
<li title="ls-2"><a href="ftp.html#ls-2">ls/2</a></li>
<li title="mkdir-2"><a href="ftp.html#mkdir-2">mkdir/2</a></li>
<li title="nlist-1"><a href="ftp.html#nlist-1">nlist/1</a></li>
<li title="nlist-2"><a href="ftp.html#nlist-2">nlist/2</a></li>
<li title="open-1"><a href="ftp.html#open-1">open/1</a></li>
<li title="open-2"><a href="ftp.html#open-2">open/2</a></li>
<li title="pwd-1"><a href="ftp.html#pwd-1">pwd/1</a></li>
<li title="pwd-1"><a href="ftp.html#pwd-1">pwd/1</a></li>
<li title="recv-2"><a href="ftp.html#recv-2">recv/2</a></li>
<li title="recv-3"><a href="ftp.html#recv-3">recv/3</a></li>
<li title="recv_bin-2"><a href="ftp.html#recv_bin-2">recv_bin/2</a></li>
<li title="recv_chunk_start-2"><a href="ftp.html#recv_chunk_start-2">recv_chunk_start/2</a></li>
<li title="recv_chunk-1"><a href="ftp.html#recv_chunk-1">recv_chunk/1</a></li>
<li title="rename-3"><a href="ftp.html#rename-3">rename/3</a></li>
<li title="rmdir-2"><a href="ftp.html#rmdir-2">rmdir/2</a></li>
<li title="send-2"><a href="ftp.html#send-2">send/2</a></li>
<li title="send-3"><a href="ftp.html#send-3">send/3</a></li>
<li title="send_bin-3"><a href="ftp.html#send_bin-3">send_bin/3</a></li>
<li title="send_chunk-2"><a href="ftp.html#send_chunk-2">send_chunk/2</a></li>
<li title="send_chunk_start-2"><a href="ftp.html#send_chunk_start-2">send_chunk_start/2</a></li>
<li title="send_chunk_end-1"><a href="ftp.html#send_chunk_end-1">send_chunk_end/1</a></li>
<li title="type-2"><a href="ftp.html#type-2">type/2</a></li>
<li title="user-3"><a href="ftp.html#user-3">user/3</a></li>
<li title="user-4"><a href="ftp.html#user-4">user/4</a></li>
<li title="quote-2"><a href="ftp.html#quote-2">quote/2</a></li>
</ul>
</li>
<li id="no" title="tftp " expanded="false">tftp<ul>
<li><a href="tftp.html">
                  Top of manual page
                </a></li>
<li title="start-1"><a href="tftp.html#start-1">start/1</a></li>
<li title="read_file-3"><a href="tftp.html#read_file-3">read_file/3</a></li>
<li title="write_file-3"><a href="tftp.html#write_file-3">write_file/3</a></li>
<li title="info-1"><a href="tftp.html#info-1">info/1</a></li>
<li title="info-1"><a href="tftp.html#info-1">info/1</a></li>
<li title="info-1"><a href="tftp.html#info-1">info/1</a></li>
<li title="change_config-2"><a href="tftp.html#change_config-2">change_config/2</a></li>
<li title="change_config-2"><a href="tftp.html#change_config-2">change_config/2</a></li>
<li title="change_config-2"><a href="tftp.html#change_config-2">change_config/2</a></li>
<li title="start-0"><a href="tftp.html#start-0">start/0</a></li>
<li title="prepare-6"><a href="tftp.html#prepare-6">prepare/6</a></li>
<li title="open-6"><a href="tftp.html#open-6">open/6</a></li>
<li title="read-1"><a href="tftp.html#read-1">read/1</a></li>
<li title="write-2"><a href="tftp.html#write-2">write/2</a></li>
<li title="abort-3"><a href="tftp.html#abort-3">abort/3</a></li>
<li title="error_msg-2"><a href="tftp.html#error_msg-2">error_msg/2</a></li>
<li title="warning_msg-2"><a href="tftp.html#warning_msg-2">warning_msg/2</a></li>
<li title="info_msg-2"><a href="tftp.html#info_msg-2">info_msg/2</a></li>
</ul>
</li>
<li id="no" title="httpc " expanded="false">httpc<ul>
<li><a href="httpc.html">
                  Top of manual page
                </a></li>
<li title="request-1"><a href="httpc.html#request-1">request/1</a></li>
<li title="request-2"><a href="httpc.html#request-2">request/2</a></li>
<li title="request-4"><a href="httpc.html#request-4">request/4</a></li>
<li title="request-5"><a href="httpc.html#request-5">request/5</a></li>
<li title="cancel_request-1"><a href="httpc.html#cancel_request-1">cancel_request/1</a></li>
<li title="cancel_request-2"><a href="httpc.html#cancel_request-2">cancel_request/2</a></li>
<li title="set_options-1"><a href="httpc.html#set_options-1">set_options/1</a></li>
<li title="set_options-2"><a href="httpc.html#set_options-2">set_options/2</a></li>
<li title="get_options-1"><a href="httpc.html#get_options-1">get_options/1</a></li>
<li title="get_options-2"><a href="httpc.html#get_options-2">get_options/2</a></li>
<li title="stream_next-1"><a href="httpc.html#stream_next-1">stream_next/1</a></li>
<li title="store_cookies-2"><a href="httpc.html#store_cookies-2">store_cookies/2</a></li>
<li title="store_cookies-3"><a href="httpc.html#store_cookies-3">store_cookies/3</a></li>
<li title="cookie_header-1"><a href="httpc.html#cookie_header-1">cookie_header/1</a></li>
<li title="cookie_header-2"><a href="httpc.html#cookie_header-2">cookie_header/2</a></li>
<li title="cookie_header-3"><a href="httpc.html#cookie_header-3">cookie_header/3</a></li>
<li title="reset_cookies-0"><a href="httpc.html#reset_cookies-0">reset_cookies/0</a></li>
<li title="reset_cookies-1"><a href="httpc.html#reset_cookies-1">reset_cookies/1</a></li>
<li title="which_cookies-0"><a href="httpc.html#which_cookies-0">which_cookies/0</a></li>
<li title="which_cookies-1"><a href="httpc.html#which_cookies-1">which_cookies/1</a></li>
<li title="which_sessions-0"><a href="httpc.html#which_sessions-0">which_sessions/0</a></li>
<li title="which_sessions-1"><a href="httpc.html#which_sessions-1">which_sessions/1</a></li>
<li title="info-0"><a href="httpc.html#info-0">info/0</a></li>
<li title="info-1"><a href="httpc.html#info-1">info/1</a></li>
</ul>
</li>
<li id="no" title="httpd " expanded="false">httpd<ul>
<li><a href="httpd.html">
                  Top of manual page
                </a></li>
<li title="info-1"><a href="httpd.html#info-1">info/1</a></li>
<li title="info-2"><a href="httpd.html#info-2">info/2</a></li>
<li title="info-2"><a href="httpd.html#info-2">info/2</a></li>
<li title="info-3"><a href="httpd.html#info-3">info/3</a></li>
<li title="reload_config-2"><a href="httpd.html#reload_config-2">reload_config/2</a></li>
<li title="Module:do-1"><a href="httpd.html#Module:do-1">Module:do/1</a></li>
<li title="Module:load-2"><a href="httpd.html#Module:load-2">Module:load/2</a></li>
<li title="Module:store-2"><a href="httpd.html#Module:store-2">Module:store/2</a></li>
<li title="Module:remove-1"><a href="httpd.html#Module:remove-1">Module:remove/1</a></li>
<li title="parse_query-1"><a href="httpd.html#parse_query-1">parse_query/1</a></li>
</ul>
</li>
<li id="no" title="httpd_conf " expanded="false">httpd_conf<ul>
<li><a href="httpd_conf.html">
                  Top of manual page
                </a></li>
<li title="check_enum-2"><a href="httpd_conf.html#check_enum-2">check_enum/2</a></li>
<li title="clean-1"><a href="httpd_conf.html#clean-1">clean/1</a></li>
<li title="custom_clean-3"><a href="httpd_conf.html#custom_clean-3">custom_clean/3</a></li>
<li title="is_directory-1"><a href="httpd_conf.html#is_directory-1">is_directory/1</a></li>
<li title="is_file-1"><a href="httpd_conf.html#is_file-1">is_file/1</a></li>
<li title="make_integer-1"><a href="httpd_conf.html#make_integer-1">make_integer/1</a></li>
</ul>
</li>
<li id="no" title="httpd_socket " expanded="false">httpd_socket<ul>
<li><a href="httpd_socket.html">
                  Top of manual page
                </a></li>
<li title="deliver-3"><a href="httpd_socket.html#deliver-3">deliver/3</a></li>
<li title="peername-2"><a href="httpd_socket.html#peername-2">peername/2</a></li>
<li title="resolve-0"><a href="httpd_socket.html#resolve-0">resolve/0</a></li>
</ul>
</li>
<li id="no" title="httpd_util " expanded="false">httpd_util<ul>
<li><a href="httpd_util.html">
                  Top of manual page
                </a></li>
<li title="convert_request_date-1"><a href="httpd_util.html#convert_request_date-1">convert_request_date/1</a></li>
<li title="create_etag-1"><a href="httpd_util.html#create_etag-1">create_etag/1</a></li>
<li title="decode_hex-1"><a href="httpd_util.html#decode_hex-1">decode_hex/1</a></li>
<li title="day-1"><a href="httpd_util.html#day-1">day/1</a></li>
<li title="flatlength-1"><a href="httpd_util.html#flatlength-1">flatlength/1</a></li>
<li title="hexlist_to_integer-1"><a href="httpd_util.html#hexlist_to_integer-1">hexlist_to_integer/1</a></li>
<li title="integer_to_hexlist-1"><a href="httpd_util.html#integer_to_hexlist-1">integer_to_hexlist/1</a></li>
<li title="lookup-2"><a href="httpd_util.html#lookup-2">lookup/2</a></li>
<li title="lookup-3"><a href="httpd_util.html#lookup-3">lookup/3</a></li>
<li title="lookup_mime-2"><a href="httpd_util.html#lookup_mime-2">lookup_mime/2</a></li>
<li title="lookup_mime-3"><a href="httpd_util.html#lookup_mime-3">lookup_mime/3</a></li>
<li title="lookup_mime_default-2"><a href="httpd_util.html#lookup_mime_default-2">lookup_mime_default/2</a></li>
<li title="lookup_mime_default-3"><a href="httpd_util.html#lookup_mime_default-3">lookup_mime_default/3</a></li>
<li title="message-3"><a href="httpd_util.html#message-3">message/3</a></li>
<li title="month-1"><a href="httpd_util.html#month-1">month/1</a></li>
<li title="multi_lookup-2"><a href="httpd_util.html#multi_lookup-2">multi_lookup/2</a></li>
<li title="reason_phrase-1"><a href="httpd_util.html#reason_phrase-1">reason_phrase/1</a></li>
<li title="rfc1123_date-0"><a href="httpd_util.html#rfc1123_date-0">rfc1123_date/0</a></li>
<li title="rfc1123_date-2"><a href="httpd_util.html#rfc1123_date-2">rfc1123_date/2</a></li>
<li title="split-3"><a href="httpd_util.html#split-3">split/3</a></li>
<li title="split_script_path-1"><a href="httpd_util.html#split_script_path-1">split_script_path/1</a></li>
<li title="split_path-1"><a href="httpd_util.html#split_path-1">split_path/1</a></li>
<li title="strip-1"><a href="httpd_util.html#strip-1">strip/1</a></li>
<li title="suffix-1"><a href="httpd_util.html#suffix-1">suffix/1</a></li>
</ul>
</li>
<li id="no" title="mod_alias " expanded="false">mod_alias<ul>
<li><a href="mod_alias.html">
                  Top of manual page
                </a></li>
<li title="default_index-2"><a href="mod_alias.html#default_index-2">default_index/2</a></li>
<li title="path-3"><a href="mod_alias.html#path-3">path/3</a></li>
<li title="real_name-3"><a href="mod_alias.html#real_name-3">real_name/3</a></li>
<li title="real_script_name-3"><a href="mod_alias.html#real_script_name-3">real_script_name/3</a></li>
</ul>
</li>
<li id="no" title="mod_auth " expanded="false">mod_auth<ul>
<li><a href="mod_auth.html">
                  Top of manual page
                </a></li>
<li title="add_user-2"><a href="mod_auth.html#add_user-2">add_user/2</a></li>
<li title="add_user-5"><a href="mod_auth.html#add_user-5">add_user/5</a></li>
<li title="add_user-6"><a href="mod_auth.html#add_user-6">add_user/6</a></li>
<li title="delete_user-2"><a href="mod_auth.html#delete_user-2">delete_user/2</a></li>
<li title="delete_user-3"><a href="mod_auth.html#delete_user-3">delete_user/3</a></li>
<li title="delete_user-4"><a href="mod_auth.html#delete_user-4">delete_user/4</a></li>
<li title="get_user-2"><a href="mod_auth.html#get_user-2">get_user/2</a></li>
<li title="get_user-3"><a href="mod_auth.html#get_user-3">get_user/3</a></li>
<li title="get_user-4"><a href="mod_auth.html#get_user-4">get_user/4</a></li>
<li title="list_users-1"><a href="mod_auth.html#list_users-1">list_users/1</a></li>
<li title="list_users-2"><a href="mod_auth.html#list_users-2">list_users/2</a></li>
<li title="list_users-3"><a href="mod_auth.html#list_users-3">list_users/3</a></li>
<li title="add_group_member-3"><a href="mod_auth.html#add_group_member-3">add_group_member/3</a></li>
<li title="add_group_member-4"><a href="mod_auth.html#add_group_member-4">add_group_member/4</a></li>
<li title="add_group_member-5"><a href="mod_auth.html#add_group_member-5">add_group_member/5</a></li>
<li title="delete_group_member-3"><a href="mod_auth.html#delete_group_member-3">delete_group_member/3</a></li>
<li title="delete_group_member-4"><a href="mod_auth.html#delete_group_member-4">delete_group_member/4</a></li>
<li title="delete_group_member-5"><a href="mod_auth.html#delete_group_member-5">delete_group_member/5</a></li>
<li title="list_group_members-2"><a href="mod_auth.html#list_group_members-2">list_group_members/2</a></li>
<li title="list_group_members-3"><a href="mod_auth.html#list_group_members-3">list_group_members/3</a></li>
<li title="list_group_members-4"><a href="mod_auth.html#list_group_members-4">list_group_members/4</a></li>
<li title="list_groups-1"><a href="mod_auth.html#list_groups-1">list_groups/1</a></li>
<li title="list_groups-2"><a href="mod_auth.html#list_groups-2">list_groups/2</a></li>
<li title="list_groups-3"><a href="mod_auth.html#list_groups-3">list_groups/3</a></li>
<li title="delete_group-2"><a href="mod_auth.html#delete_group-2">delete_group/2</a></li>
<li title="delete_group-4"><a href="mod_auth.html#delete_group-4">delete_group/4</a></li>
<li title="update_password-5"><a href="mod_auth.html#update_password-5">update_password/5</a></li>
<li title="update_password-6"><a href="mod_auth.html#update_password-6">update_password/6</a></li>
</ul>
</li>
<li id="no" title="mod_esi " expanded="false">mod_esi<ul>
<li><a href="mod_esi.html">
                  Top of manual page
                </a></li>
<li title="deliver-2"><a href="mod_esi.html#deliver-2">deliver/2</a></li>
<li title="Module:Function-3"><a href="mod_esi.html#Module:Function-3">Module:Function/3</a></li>
<li title="Module:Function-2"><a href="mod_esi.html#Module:Function-2">Module:Function/2</a></li>
</ul>
</li>
<li id="no" title="mod_security " expanded="false">mod_security<ul>
<li><a href="mod_security.html">
                  Top of manual page
                </a></li>
<li title="list_auth_users-1"><a href="mod_security.html#list_auth_users-1">list_auth_users/1</a></li>
<li title="list_auth_users-2"><a href="mod_security.html#list_auth_users-2">list_auth_users/2</a></li>
<li title="list_auth_users-2"><a href="mod_security.html#list_auth_users-2">list_auth_users/2</a></li>
<li title="list_auth_users-3"><a href="mod_security.html#list_auth_users-3">list_auth_users/3</a></li>
<li title="list_blocked_users-1"><a href="mod_security.html#list_blocked_users-1">list_blocked_users/1</a></li>
<li title="list_blocked_users-2"><a href="mod_security.html#list_blocked_users-2">list_blocked_users/2</a></li>
<li title="list_blocked_users-2"><a href="mod_security.html#list_blocked_users-2">list_blocked_users/2</a></li>
<li title="list_blocked_users-3"><a href="mod_security.html#list_blocked_users-3">list_blocked_users/3</a></li>
<li title="block_user-4"><a href="mod_security.html#block_user-4">block_user/4</a></li>
<li title="block_user-5"><a href="mod_security.html#block_user-5">block_user/5</a></li>
<li title="unblock_user-2"><a href="mod_security.html#unblock_user-2">unblock_user/2</a></li>
<li title="unblock_user-3"><a href="mod_security.html#unblock_user-3">unblock_user/3</a></li>
<li title="unblock_user-3"><a href="mod_security.html#unblock_user-3">unblock_user/3</a></li>
<li title="unblock_user-4"><a href="mod_security.html#unblock_user-4">unblock_user/4</a></li>
<li title="event-4"><a href="mod_security.html#event-4">event/4</a></li>
<li title="event-5"><a href="mod_security.html#event-5">event/5</a></li>
</ul>
</li>
<li id="no" title="http_uri " expanded="false">http_uri<ul>
<li><a href="http_uri.html">
                  Top of manual page
                </a></li>
<li title="scheme_defaults-0"><a href="http_uri.html#scheme_defaults-0">scheme_defaults/0</a></li>
<li title="parse-1"><a href="http_uri.html#parse-1">parse/1</a></li>
<li title="parse-2"><a href="http_uri.html#parse-2">parse/2</a></li>
<li title="encode-1"><a href="http_uri.html#encode-1">encode/1</a></li>
<li title="decode-1"><a href="http_uri.html#decode-1">decode/1</a></li>
</ul>
</li>
</ul>
</div></div>
<div id="content">
<div class="innertube">
<!-- refpage --><center><h1>ftp</h1></center>
  
  <h3>MODULE</h3>
<div class="REFBODY">ftp</div>
  <h3>MODULE SUMMARY</h3>
<div class="REFBODY">A File Transfer Protocol client</div>

  <h3>DESCRIPTION</h3>
<div class="REFBODY"><p>

    <p>The <span class="code">ftp</span> module implements a client for file transfer
      according to a subset of the File Transfer Protocol (see RFC959). </p>

    <p>Starting from inets version 4.4.1 the ftp
      client will always try to use passive ftp mode and only resort
      to active ftp mode if this fails. There is a start option 
      <span class="bold_code"><a href="#mode">mode</a></span> where this default behavior 
      may be changed. </p>

    <a name="two_start"></a>

    <p>There are two ways to start an ftp client. One is using the 
      <span class="bold_code"><a href="#service_start">Inets service framework</a></span>
      and the other is to start it directy as a standalone process 
      using the <span class="bold_code"><a href="#open">open</a></span> function. </p>

    <p>For a simple example of an ftp session see 
      <span class="bold_code"><a href="ftp_client.html">Inets User's Guide.</a></span></p>

    <p>In addition to the ordinary functions for receiving and sending
      files (see <span class="code">recv/2</span>, <span class="code">recv/3</span>, <span class="code">send/2</span> and
      <span class="code">send/3</span>) there are functions for receiving remote files as
      binaries (see <span class="code">recv_bin/2</span>) and for sending binaries to to be
      stored as remote files (see <span class="code">send_bin/3</span>).</p>

    <p>There is also a set of functions for sending and receiving
      contiguous parts of a file to be stored in a remote file (for send
      see <span class="code">send_chunk_start/2</span>, <span class="code">send_chunk/2</span> and
      <span class="code">send_chunk_end/1</span> and for receive see
      <span class="code">recv_chunk_start/2</span> and <span class="code">recv_chunk/</span>).</p>

    <p>The particular return values of the functions below depend very
      much on the implementation of the FTP server at the remote
      host. In particular the results from <span class="code">ls</span> and <span class="code">nlist</span>
      varies. Often real errors are not reported as errors by <span class="code">ls</span>,
      even if for instance a file or directory does not
      exist. <span class="code">nlist</span> is usually more strict, but some
      implementations have the peculiar behaviour of responding with an
      error, if the request is a listing of the contents of directory
      which exists but is empty.</p>

    <a name="service_start"></a>
  </p></div>

  <h3><a name="id58631">FTP CLIENT SERVICE START/STOP </a></h3>
<div class="REFBODY">
    
    
    <p>The FTP client can be started and stopped dynamically in runtime by
      calling the Inets application API 
      <span class="code">inets:start(ftpc, ServiceConfig)</span>,
      or <span class="code">inets:start(ftpc, ServiceConfig, How)</span>, and
      <span class="code">inets:stop(ftpc, Pid)</span>. 
      See <span class="bold_code"><a href="inets.html">inets(3)</a></span> for more info. </p>
    <p>Below follows a description of
      the available configuration options.</p>
    
    <dl>
      <dt><strong>{host, Host}</strong></dt>
      <dd>
        <a name="host"></a>
	<p>Host = <span class="code">string() | ip_address()</span> </p>
      </dd>

      <dt><strong>{port, Port}</strong></dt>
      <dd>
        <a name="port"></a>
	<p>Port = <span class="code">integer() &gt; 0</span> </p>
	<p>Default is 21.</p>
      </dd>

      <dt><strong>{mode, Mode}</strong></dt>
      <dd>
        <a name="mode"></a>
	<p>Mode = <span class="code">active | passive</span> </p>
	<p>Default is <span class="code">passive</span>. </p> 
      </dd>

      <dt><strong>{verbose, Verbose}</strong></dt>
      <dd>
        <a name="verbose"></a>
	<p>Verbose = <span class="code">boolean()</span> </p>
	<p>This determines if the FTP communication should be
	  verbose or not. </p>
	<p>Default is <span class="code">false</span>. </p>
      </dd>

      <dt><strong>{debug, Debug}</strong></dt>
      <dd>
        <a name="debug"></a>
	<p>Debug = <span class="code">trace | debug | disable</span> </p>
	<p>Debugging using the dbg toolkit. </p>
	<p>Default is <span class="code">disable</span>. </p>
      </dd>

      <dt><strong>{ipfamily, IpFamily}</strong></dt>
      <dd>
        <a name="ipfamily"></a>
	<p>IpFamily = <span class="code">inet | inet6 | inet6fb4</span> </p>
	<p>With <span class="code">inet6fb4</span> the client behaves as before 
	  (it tries to use IPv6 and only if that does not work, it 
          uses IPv4). </p>
	<p>Default is <span class="code">inet</span> (IPv4). </p>
      </dd>

      <dt><strong>{timeout, Timeout}</strong></dt>
      <dd>
        <a name="timeout"></a>
	<p>Timeout = <span class="code">non_neg_integer()</span> </p>
	<p>Connection timeout. </p>
	<p>Default is 60000 (milliseconds). </p>
      </dd>

      <dt><strong>{dtimeout, DTimeout}</strong></dt>
      <dd>
        <a name="dtimeout"></a>
	<p>DTimeout = <span class="code">non_neg_integer() | infinity</span> </p>
	<p>Data Connect timeout. 
	The time the client will wait for the server to connect to the 
	data socket. </p>
	<p>Default is infinity. </p>
      </dd>

      <dt><strong>{progress, Progress}</strong></dt>
      <dd>
        <a name="progress"></a>
	<p>Progress = <span class="code">ignore | {CBModule, CBFunction, InitProgress}</span></p>
	<p>CBModule = <span class="code">atom()</span>, CBFunction = <span class="code">atom()</span> </p>
	<p>InitProgress = <span class="code">term()</span> </p>
	<p>Default is <span class="code">ignore</span>. </p>
      </dd>  

    </dl>
  
    <p>The progress option is intended to be used by applications that
      want to create some type of progress report such as a progress bar in
      a GUI.  The default value for the progress option is ignore
      e.i. the option is not used.  When the progress option is
      specified the following will happen when ftp:send/[3,4] or
      ftp:recv/[3,4] are called.</p>
    
    <ul>
      <li>
	<p>Before a file is transfered the following call will
	  be made to indicate the start of the file transfer and how big
	  the file is. The return value of the callback function
	  should be a new value for the UserProgressTerm that will
	  bu used as input next time the callback function is
	  called.</p>
	<br>
	<p><span class="code">
	  CBModule:CBFunction(InitProgress, File, {file_size, FileSize})
	</span></p>
	<br>
      </li>
      
      <li>
	<p>Every time a chunk of bytes is transfered the
	  following call will be made:</p>
	<br>
	<p><span class="code">
	    CBModule:CBFunction(UserProgressTerm, File, {transfer_size, TransferSize})             </span></p>
	<br>
      </li>

      <li>
	<p>At the end of the file the following call will be
	  made to indicate the end of the transfer.</p>
	<br>
	<p><span class="code">
	    CBModule:CBFunction(UserProgressTerm, File, {transfer_size, 0})             </span></p>
	<br>
      </li>
    </ul>
    
    <p>The callback function should be defined as </p>

    <p><span class="code">
	CBModule:CBFunction(UserProgressTerm, File, Size) -&gt; UserProgressTerm        </span></p>
    
    <p><span class="code">
	CBModule = CBFunction = atom()
      </span></p>

    <p><span class="code">
	UserProgressTerm = term()
      </span></p>

    <p><span class="code">
	File = string()
      </span></p>

    <p><span class="code">
	Size = {transfer_size, integer()} | {file_size, integer()} | {file_size, unknown}        </span></p>
    
    <p>Alas for remote files it is not possible for ftp to determine the
      file size in a platform independent way. In this case the size
      will be <span class="code">unknown</span> and it is left to the application to find
      out the size. </p>
    
    <div class="note">
<div class="label">Note</div>
<div class="content"><p>
      <p>The callback is made by a middleman process, hence the
	file transfer will not be affected by the code in the progress
	callback function. If the callback should crash this will be
	detected by the ftp connection process that will print an
	info-report and then go one as if the progress option was set
	to ignore. </p>
    </p></div>
</div>
    
    <p>The file transfer type is set to the default of the FTP server
      when the session is opened. This is usually ASCCI-mode.
    </p>
    
    <p>The current local working directory (cf. <span class="code">lpwd/1</span>) is set to
      the value reported by <span class="code">file:get_cwd/1</span>. the wanted
      local directory.
    </p>
    
    <p>The return value <span class="code">Pid</span> is used as a reference to the
      newly created ftp client in all other functions, and they should
      be called by the process that created the connection. The ftp
      client process monitors the process that created it and
      will terminate if that process terminates.</p>   
  </div>
  
  <h3><a name="id72348">COMMON DATA TYPES </a></h3>
<div class="REFBODY">
    
    <p>Here follows type definitions that are used by more than one
      function in the FTP client API. </p>
    <p><span class="code"> pid() - identifier of an ftp connection.</span></p>
    <p><span class="code"> string() = list of ASCII characters.</span></p>
    <p><span class="code"> shortage_reason() = etnospc | epnospc</span></p>
    <p><span class="code"> restriction_reason() = epath | efnamena | elogin | enotbinary
      - note not all restrictions may always relevant to all functions
    </span></p>
    <p><span class="code">common_reason() = econn | eclosed | term() - some kind of
      explanation of what went wrong.</span></p>

    <a name="account"></a>
  </div>

  <h3>EXPORTS</h3>
    <p><a name="account-2"><span class="bold_code">account(Pid, Account) -&gt; ok | {error, Reason}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Pid = pid()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Account = string()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = eacct | common_reason()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>If an account is needed for an operation set the account
          with this operation.</p>

       <a name="append"></a>
       <a name="append2"></a>
       <a name="append3"></a>
      </p></div>

    <p><a name="append-2"><span class="bold_code">append(Pid, LocalFile) -&gt; </span></a><br><a name="append-3"><span class="bold_code">append(Pid, LocalFile, RemoteFile) -&gt; ok | {error, Reason}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Pid = pid()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">LocalFile = RemoteFile = string()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = epath | elogin | etnospc | epnospc | efnamena | common_reason</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Transfers the file <span class="code">LocalFile</span> to the remote server. If 
          <span class="code">RemoteFile</span> is specified, the name of the remote file that the
          file will be appended to is set to <span class="code">RemoteFile</span>; otherwise 
          the name is set to <span class="code">LocalFile</span> If the file does not exists the
          file will be created.</p>

       <a name="append_bin"></a>
      </p></div>

    <p><a name="append_bin-3"><span class="bold_code">append_bin(Pid, Bin, RemoteFile) -&gt; ok | {error, Reason}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Pid = pid()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Bin = binary()()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">RemoteFile = string()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason =  restriction_reason()| shortage_reason() | common_reason()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Transfers the binary <span class="code">Bin</span> to the remote server and append 
          it to the file <span class="code">RemoteFile</span>. If the file does not exists it 
          will be created.</p>

       <a name="append_chunk"></a>
      </p></div>

    <p><a name="append_chunk-2"><span class="bold_code">append_chunk(Pid, Bin) -&gt; ok | {error, Reason}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Pid = pid()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Bin = binary()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = echunk | restriction_reason() | common_reason()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Transfer the chunk <span class="code">Bin</span> to the remote server, which 
          append it into the file specified in the call to 
          <span class="code">append_chunk_start/2</span>. </p>
        <p>Note that for some errors, e.g. file system full, it is 
          necessary to to call <span class="code">append_chunk_end</span> to get the 
          proper reason.</p>

       <a name="append_chunk_start"></a>
      </p></div>

    <p><a name="append_chunk_start-2"><span class="bold_code">append_chunk_start(Pid, File) -&gt; ok | {error, Reason}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Pid = pid()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">File = string()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = restriction_reason() | common_reason()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Start the transfer of chunks for appending to the file 
          <span class="code">File</span> at the remote server. If the file does not exists 
          it will be created.</p>

       <a name="append_chunk_end"></a>
      </p></div>

    <p><a name="append_chunk_end-1"><span class="bold_code">append_chunk_end(Pid) -&gt; ok | {error, Reason}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Pid = pid()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = echunk | restriction_reason() | shortage_reason() </span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Stops transfer of chunks for appending to the remote server. 
          The file at the remote server, specified in the call to 
          <span class="code">append_chunk_start/2</span> is closed by the server.</p>

       <a name="cd"></a>
      </p></div>

    <p><a name="cd-2"><span class="bold_code">cd(Pid, Dir) -&gt; ok | {error, Reason}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Pid = pid()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Dir = string()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = restriction_reason() | common_reason() </span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Changes the working directory at the remote server to 
          <span class="code">Dir</span>.</p>

       <a name="close"></a>
      </p></div>
    
    <p><a name="close-1"><span class="bold_code">close(Pid) -&gt; ok</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
	<div class="REFTYPES">
<span class="bold_code">Pid = pid()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
	<p>Ends an ftp session, created using the 
          <span class="bold_code"><a href="#open">open</a></span> function. </p>

       <a name="delete"></a>
      </p></div>

    <p><a name="delete-2"><span class="bold_code">delete(Pid, File) -&gt; ok | {error, Reason}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Pid = pid()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">File = string()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = restriction_reason() | common_reason()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Deletes the file <span class="code">File</span> at the remote server.</p>

       <a name="append"></a>
      </p></div>

    <p><a name="formaterror-1"><span class="bold_code">formaterror(Tag) -&gt; string()</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Tag = {error, atom()} | atom()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Given an error return value <span class="code">{error, AtomReason}</span>,
          this function returns a readable string describing the error.</p>

       <a name="lcd"></a>
      </p></div>

    <p><a name="lcd-2"><span class="bold_code">lcd(Pid, Dir) -&gt; ok | {error, Reason}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Pid = pid()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Dir = string()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = restriction_reason()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Changes the working directory to <span class="code">Dir</span> for the local client. </p>

       <a name="lpwd"></a>
      </p></div>

    <p><a name="lpwd-1"><span class="bold_code">lpwd(Pid) -&gt; {ok, Dir}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Pid = pid()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Returns the current working directory at the local client.</p>

       <a name="ls"></a>
       <a name="ls1"></a>
       <a name="ls2"></a>
      </p></div>

    <p><a name="ls-1"><span class="bold_code">ls(Pid) -&gt; </span></a><br><a name="ls-2"><span class="bold_code">ls(Pid, Pathname) -&gt; {ok, Listing} | {error, Reason}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Pid = pid()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Pathname = string()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Listing = string()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = restriction_reason() | common_reason()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Returns a list of files in long format. </p>
        <p><span class="code">Pathname</span> can be a directory, a group of files or 
          even a file. The <span class="code">Pathname</span> string can contain wildcard(s). </p>
        <p><span class="code">ls/1</span> implies the user's current remote directory. </p>
        <p>The format of <span class="code">Listing</span> is operating system dependent 
          (on UNIX it is typically produced from the output of the 
          <span class="code">ls -l</span> shell command).</p>

       <a name="mkdir"></a>
      </p></div>

    <p><a name="mkdir-2"><span class="bold_code">mkdir(Pid, Dir) -&gt; ok | {error, Reason}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Pid = pid()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Dir = string()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = restriction_reason() | common_reason()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Creates the directory <span class="code">Dir</span> at the remote server.</p>

       <a name="nlist"></a>
       <a name="nlist1"></a>
       <a name="nlist2"></a>
      </p></div>

    <p><a name="nlist-1"><span class="bold_code">nlist(Pid) -&gt; </span></a><br><a name="nlist-2"><span class="bold_code">nlist(Pid, Pathname) -&gt; {ok, Listing} | {error, Reason}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Pid = pid()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Pathname = string()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Listing = string()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = restriction_reason() | common_reason()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Returns a list of files in short format. </p>
        <p><span class="code">Pathname</span> can be a directory, a group of files or 
          even a file. The <span class="code">Pathname</span> string can contain wildcard(s). </p>
        <p><span class="code">nlist/1</span> implies the user's current remote directory. </p>
        <p>The format of <span class="code">Listing</span> is a stream of
          file names, where each name is separated by &lt;CRLF&gt; or
          &lt;NL&gt;. Contrary to the <span class="code">ls</span> function, the purpose of
          <span class="code">nlist</span> is to make it possible for a program to
          automatically process file name information.</p>

       <a name="open"></a>
      </p></div>

    <p><a name="open-1"><span class="bold_code">open(Host) -&gt; {ok, Pid} | {error, Reason}</span></a><br><a name="open-2"><span class="bold_code">open(Host, Opts) -&gt; {ok, Pid} | {error, Reason}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
	<div class="REFTYPES">
<span class="bold_code">Host = string() | ip_address()</span><br>
</div>
	<div class="REFTYPES">
<span class="bold_code">Opts = options()</span><br>
</div>
	<div class="REFTYPES">
<span class="bold_code">options() = [option()]</span><br>
</div>
	<div class="REFTYPES">
<span class="bold_code">option() = start_option() | open_option()</span><br>
</div>
	
	<div class="REFTYPES">
<span class="bold_code">start_option() = {verbose, verbose()} | {debug, debug()}</span><br>
</div>
	<div class="REFTYPES">
<span class="bold_code">verbose() = boolean() (defaults to false)</span><br>
</div>
	<div class="REFTYPES">
<span class="bold_code">debug() = disable | debug | trace (defaults to disable)</span><br>
</div>
	
	<div class="REFTYPES">
<span class="bold_code">open_option() = {ipfamily, ipfamily()} | {port, port()} | {mode, mode()} | {timeout, timeout()} | {dtimeout, dtimeout()} | {progress, progress()}</span><br>
</div>
	<div class="REFTYPES">
<span class="bold_code">ipfamily() = inet | inet6 | inet6fb4 (defaults to inet)</span><br>
</div>
	<div class="REFTYPES">
<span class="bold_code">port() = integer() &gt; 0 (defaults to 21)</span><br>
</div>
	<div class="REFTYPES">
<span class="bold_code">mode() = active | passive (defaults to passive)</span><br>
</div>
	<div class="REFTYPES">
<span class="bold_code">timeout() = integer() &gt; 0 (defaults to 60000 milliseconds)</span><br>
</div>
	<div class="REFTYPES">
<span class="bold_code">dtimeout() = integer() &gt; 0 | infinity (defaults to infinity)</span><br>
</div>
	<div class="REFTYPES">
<span class="bold_code">pogress() = ignore | {module(), function(), initial_data()} (defaults to ignore)</span><br>
</div>
	<div class="REFTYPES">
<span class="bold_code">module() = atom()</span><br>
</div>
	<div class="REFTYPES">
<span class="bold_code">function() = atom()</span><br>
</div>
	<div class="REFTYPES">
<span class="bold_code">initial_data() = term()</span><br>
</div>
	<div class="REFTYPES">
<span class="bold_code">Reason = ehost | term()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
	<p>This function is used to start a standalone ftp client process 
          (without the inets service framework) and 
          open a session with the FTP server at <span class="code">Host</span>. </p>

        <p>A session opened in this way, is closed using the 
          <span class="bold_code"><a href="#close">close</a></span> function. </p>

       <a name="pwd"></a>
      </p></div>

    <p><a name="pwd-1"><span class="bold_code">pwd(Pid) -&gt; {ok, Dir} | {error, Reason}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
	<div class="REFTYPES">
<span class="bold_code">Pid = pid()</span><br>
</div>
	<div class="REFTYPES">
<span class="bold_code">Reason = restriction_reason() | common_reason() </span><br>
</div>
      </div>
<div class="REFBODY"><p>
	<p>Returns the current working directory at the remote server. </p>
      </p></div>

    <p><a name="pwd-1"><span class="bold_code">pwd(Pid) -&gt; {ok, Dir} | {error, Reason}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Pid = pid()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = restriction_reason() | common_reason() </span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Returns the current working directory at the remote server.</p>

       <a name="recv"></a>
       <a name="recv2"></a>
       <a name="recv3"></a>
      </p></div>

    <p><a name="recv-2"><span class="bold_code">recv(Pid, RemoteFile) -&gt; </span></a><br><a name="recv-3"><span class="bold_code">recv(Pid, RemoteFile, LocalFile) -&gt; ok | {error, Reason}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Pid = pid()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">RemoteFile = LocalFile = string()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = restriction_reason() | common_reason() | file_write_error_reason() </span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">file_write_error_reason() = see file:write/2</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Transfer the file <span class="code">RemoteFile</span> from the remote server
          to the the file system of the local client. If
          <span class="code">LocalFile</span> is specified, the local file will be
          <span class="code">LocalFile</span>; otherwise it will be
          <span class="code">RemoteFile</span>.</p>
        <p>If the file write fails
          (e.g. enospc), then the command is aborted and <span class="code">{error, file_write_error_reason()}</span> is returned. The file is
          however <strong>not</strong> removed.</p>

       <a name="recv_bin"></a>
      </p></div>

    <p><a name="recv_bin-2"><span class="bold_code">recv_bin(Pid, RemoteFile) -&gt; {ok, Bin} | {error, Reason}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Pid = pid()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Bin = binary()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">RemoteFile = string()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = restriction_reason() | common_reason()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Transfers the file <span class="code">RemoteFile</span> from the remote server and 
          receives it as a binary.</p>

       <a name="recv_chunk_start"></a>
      </p></div>

    <p><a name="recv_chunk_start-2"><span class="bold_code">recv_chunk_start(Pid, RemoteFile) -&gt; ok | {error, Reason}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Pid = pid()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">RemoteFile = string()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = restriction_reason() | common_reason()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Start transfer of the file <span class="code">RemoteFile</span> from the
          remote server.</p>

       <a name="recv_chunk"></a>
      </p></div>

    <p><a name="recv_chunk-1"><span class="bold_code">recv_chunk(Pid) -&gt; ok | {ok, Bin} | {error, Reason}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Pid = pid()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Bin = binary()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = restriction_reason() | common_reason()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Receive a chunk of the remote file (<span class="code">RemoteFile</span> of 
          <span class="code">recv_chunk_start</span>). The return values has the following 
          meaning:</p>
        <ul>
          <li>
<span class="code">ok</span> the transfer is complete.</li>
          <li>
<span class="code">{ok, Bin}</span> just another chunk of the file.</li>
          <li>
<span class="code">{error, Reason}</span> transfer failed.</li>
        </ul>

       <a name="rename"></a>
      </p></div>

    <p><a name="rename-3"><span class="bold_code">rename(Pid, Old, New) -&gt; ok | {error, Reason}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Pid = pid()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">CurrFile = NewFile = string()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = restriction_reason() | common_reason()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Renames <span class="code">Old</span> to <span class="code">New</span> at the remote server.</p>

       <a name="rmdir"></a>
      </p></div>

    <p><a name="rmdir-2"><span class="bold_code">rmdir(Pid, Dir) -&gt; ok | {error, Reason}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Pid = pid()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Dir = string()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = restriction_reason() | common_reason()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Removes directory <span class="code">Dir</span> at the remote server.</p>

       <a name="send"></a>
       <a name="send2"></a>
       <a name="send3"></a>
      </p></div>

    <p><a name="send-2"><span class="bold_code">send(Pid, LocalFile) -&gt;</span></a><br><a name="send-3"><span class="bold_code">send(Pid, LocalFile, RemoteFile) -&gt; ok | {error, Reason}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Pid = pid()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">LocalFile = RemoteFile = string()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = restriction_reason() | common_reason() | shortage_reason()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Transfers the file <span class="code">LocalFile</span> to the remote server. If 
          <span class="code">RemoteFile</span> is specified, the name of the remote file is set
          to <span class="code">RemoteFile</span>; otherwise the name is set to <span class="code">LocalFile</span>.</p>

       <a name="send_bin"></a>
      </p></div>

    <p><a name="send_bin-3"><span class="bold_code">send_bin(Pid, Bin, RemoteFile) -&gt; ok | {error, Reason}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Pid = pid()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Bin = binary()()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">RemoteFile = string()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = restriction_reason() | common_reason() | shortage_reason()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Transfers the binary <span class="code">Bin</span> into the file <span class="code">RemoteFile</span> 
          at the remote server.</p>

       <a name="send_chunk"></a>
      </p></div>

    <p><a name="send_chunk-2"><span class="bold_code">send_chunk(Pid, Bin) -&gt; ok | {error, Reason}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Pid = pid()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Bin = binary()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = echunk | restriction_reason() | common_reason()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Transfer the chunk <span class="code">Bin</span> to the remote server, which 
          writes it into the file specified in the call to 
          <span class="code">send_chunk_start/2</span>. </p>
        <p>Note that for some errors, e.g. file system full, it is 
          necessary to to call <span class="code">send_chunk_end</span> to get the 
          proper reason.</p>

       <a name="send_chunk_start"></a>
      </p></div>

    <p><a name="send_chunk_start-2"><span class="bold_code">send_chunk_start(Pid, File) -&gt; ok | {error, Reason}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Pid = pid()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">File = string()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = restriction_reason() | common_reason()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Start transfer of chunks into the file <span class="code">File</span> at the 
          remote server.</p>

       <a name="send_chunk_end"></a>
      </p></div>

    <p><a name="send_chunk_end-1"><span class="bold_code">send_chunk_end(Pid) -&gt; ok | {error, Reason}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Pid = pid()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = restriction_reason() | common_reason() | shortage_reason()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Stops transfer of chunks to the remote server. The file at the
          remote server, specified in the call to <span class="code">send_chunk_start/2</span> 
          is closed by the server.</p>

       <a name="type"></a>
      </p></div>

    <p><a name="type-2"><span class="bold_code">type(Pid, Type) -&gt; ok | {error, Reason}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Pid = pid()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Type = ascii | binary</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = etype | restriction_reason() | common_reason()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Sets the file transfer type to <span class="code">ascii</span> or <span class="code">binary</span>. When
          an ftp session is opened, the default transfer type of the
          server is used, most often <span class="code">ascii</span>, which is the default
          according to RFC 959.</p>

       <a name="user3"></a>
      </p></div>

    <p><a name="user-3"><span class="bold_code">user(Pid, User, Password) -&gt; ok | {error, Reason}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Pid = pid()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">User = Password = string()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = euser | common_reason()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Performs login of <span class="code">User</span> with <span class="code">Password</span>.</p>

       <a name="user4"></a>
      </p></div>

    <p><a name="user-4"><span class="bold_code">user(Pid, User, Password, Account) -&gt; ok | {error, Reason}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Pid = pid()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">User = Password = string()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = euser | common_reason() </span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Performs login of <span class="code">User</span> with <span class="code">Password</span> to the account 
          specified by <span class="code">Account</span>.</p>

       <a name="quote"></a>
      </p></div>

    <p><a name="quote-2"><span class="bold_code">quote(Pid, Command) -&gt; [FTPLine]</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Pid = pid()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Command = string()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">FTPLine = string() - Note the telnet end of line characters, from the ftp protocol definition, CRLF e.g. "\\r\\n" has been removed.</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Sends an arbitrary FTP command and returns verbatimly a list
          of the lines sent back by the FTP server. This functions is
          intended to give an application accesses to FTP commands
          that are server specific or that may not be provided by
          this FTP client. </p>
        <div class="note">
<div class="label">Note</div>
<div class="content"><p>
          <p>FTP commands that require a data connection can not be
            successfully issued with this function. </p>
        </p></div>
</div>
      </p></div>
  

  <h3><a name="id78480">ERRORS</a></h3>
<div class="REFBODY">
    
    <p>The possible error reasons and the corresponding diagnostic strings 
      returned by <span class="code">formaterror/1</span> are as follows:
      </p>
    <dl>
      <dt><strong><span class="code">echunk</span></strong></dt>
      <dd>
        <p>Synchronisation error during chunk sending. 
          </p>
        <p>A call has been made to <span class="code">send_chunk/2</span> or
          <span class="code">send_chunk_end/1</span>, before a call to
          <span class="code">send_chunk_start/2</span>; or a call has been made to another
          transfer function during chunk sending, i.e. before a call
          to <span class="code">send_chunk_end/1</span>.</p>
      </dd>
      <dt><strong><span class="code">eclosed</span></strong></dt>
      <dd>
        <p>The session has been closed.</p>
      </dd>
      <dt><strong><span class="code">econn</span></strong></dt>
      <dd>
        <p>Connection to remote server prematurely closed.</p>
      </dd>
      <dt><strong><span class="code">ehost</span></strong></dt>
      <dd>
        <p>Host not found, FTP server not found, or connection rejected
          by FTP server.</p>
      </dd>
      <dt><strong><span class="code">elogin</span></strong></dt>
      <dd>
        <p>User not logged in.</p>
      </dd>
      <dt><strong><span class="code">enotbinary</span></strong></dt>
      <dd>
        <p>Term is not a binary.</p>
      </dd>
      <dt><strong><span class="code">epath</span></strong></dt>
      <dd>
        <p>No such file or directory, or directory already exists, or
          permission denied.</p>
      </dd>
      <dt><strong><span class="code">etype</span></strong></dt>
      <dd>
        <p>No such type.</p>
      </dd>
      <dt><strong><span class="code">euser</span></strong></dt>
      <dd>
        <p>User name or password not valid.</p>
      </dd>
      <dt><strong><span class="code">etnospc</span></strong></dt>
      <dd>
        <p>Insufficient storage space in system [452].</p>
      </dd>
      <dt><strong><span class="code">epnospc</span></strong></dt>
      <dd>
        <p>Exceeded storage allocation (for current directory or
          dataset) [552].</p>
      </dd>
      <dt><strong><span class="code">efnamena</span></strong></dt>
      <dd>
        <p>File name not allowed [553].</p>
      </dd>
    </dl>
  </div>

  <h3><a name="id78669">SEE ALSO</a></h3>
<div class="REFBODY">
    
    <p>file, filename, J. Postel and J. Reynolds: File Transfer Protocol
      (RFC 959).
      </p>
  </div>
  
</div>
<div class="footer">
<hr>
<p>Copyright © 1997-2012 Ericsson AB. All Rights Reserved.</p>
</div>
</div>
</div></body>
</html>