Sophie

Sophie

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

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 -- tftp</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="no" title="ftp " expanded="false">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="loadscrollpos" title="tftp " expanded="true">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>tftp</h1></center>
  
  <h3>MODULE</h3>
<div class="REFBODY">tftp</div>
  <h3>MODULE SUMMARY</h3>
<div class="REFBODY">Trivial FTP</div>
  <h3>DESCRIPTION</h3>
<div class="REFBODY"><p>
    <p>This is a complete implementation of the following IETF standards:</p>
    <ul>
      <li>RFC 1350, The TFTP Protocol (revision 2).</li>
      <li>RFC 2347, TFTP Option Extension.</li>
      <li>RFC 2348, TFTP Blocksize Option.</li>
      <li>RFC 2349, TFTP Timeout Interval and Transfer Size Options.</li>
    </ul>
    <p>The only feature that not is implemented in this release is
      the "netascii" transfer mode.</p>
    <p>The <span class="bold_code"><a href="#start-1">start/1</a></span> function starts
      a daemon process which listens for UDP packets on a port. When it
      receives a request for read or write it spawns a temporary server
      process which handles the actual transfer of the file.</p>
    <p>On the client side
      the <span class="bold_code"><a href="#read_file-3">read_file/3</a></span>
      and <span class="bold_code"><a href="#write_file-3">write_file/3</a></span>
      functions spawns a temporary client process which establishes
      contact with a TFTP daemon and performs the actual transfer of
      the file.</p>
    <p><span class="code">tftp</span> uses a callback module to handle the actual file
      transfer. Two such callback modules are provided,
      <span class="code">tftp_binary</span> and <span class="code">tftp_file</span>. See
      <span class="bold_code"><a href="#read_file-3">read_file/3</a></span> and
      <span class="bold_code"><a href="#write_file-3">write_file/3</a></span> for
      more information about these. The user can also implement own
      callback modules, see <span class="bold_code"><a href="#tftp_callback">CALLBACK FUNCTIONS</a></span> below. A callback module provided by
      the user is registered using the <span class="code">callback</span> option, see
      <span class="bold_code"><a href="#options">DATA TYPES</a></span> below.</p>
  </p></div>
  
 <h3><a name="id78842">TFTP SERVER SERVICE START/STOP </a></h3>
<div class="REFBODY">
    
    
    <p>A TFTP server can be configured to start statically when starting
      the Inets application. Alternatively it can be started dynamically
      (when Inets already is started) by calling the Inets application API
      <span class="code">inets:start(tftpd, ServiceConfig)</span>, or
      <span class="code">inets:start(tftpd, ServiceConfig, How)</span>,
      see <span class="bold_code"><a href="inets.html">inets(3)</a></span> for details.
      The <span class="code">ServiceConfig</span> for TFTP is described below in
      the <span class="bold_code"><a href="#options">COMMON DATA TYPES</a></span>
      section.</p>
    
    <p>The TFTP server can be stopped using <span class="code">inets:stop(tftpd, Pid)</span>,
      see <span class="bold_code"><a href="inets.html">inets(3)</a></span> for details.</p>

    <p>The TPFT client is of such a temporary nature that it is not
      handled as a service in the Inets service framework.</p>
    
  </div>
  
  <h3><a name="id78902">COMMON DATA TYPES</a></h3>
<div class="REFBODY">
    <a name="options"></a>
    
    <div class="example"><pre>
      ServiceConfig = Options
      Options = [option()]
      option() -- see below
    </pre></div>
    <p>Most of the options are common for both the client and the server
      side, but some of them differs a little. Here are the available
      options:</p>
    <dl>
      <dt><strong><span class="code">{debug, Level}</span></strong></dt>
      <dd>
        <p><span class="code">Level = none | error | warning | brief | normal | verbose | all</span></p>
        <p>Controls the level of debug printouts. The default is
          <span class="code">none</span>.</p>
      </dd>
      <dt><strong><span class="code">{host, Host}</span></strong></dt>
      <dd>
        <p><span class="code">Host = hostname()</span> see
          <span class="bold_code"><a href="javascript:erlhref('../../../../doc/../','kernel','inet.html');">inet(3)</a></span></p>
        <p>The name or IP address of the host where the TFTP daemon
          resides. This option is only used by the client.</p>
      </dd>
      <dt><strong><span class="code">{port, Port}</span></strong></dt>
      <dd>
        <p><span class="code">Port = int()</span></p>
        <p>The TFTP port where the daemon listens. It defaults to
          the standardized number 69. On the server side it may
          sometimes make sense to set it to 0, which means that
          the daemon just will pick a free port (which one is
          returned by the <span class="code">info/1</span> function).</p>
        <p>If a socket has somehow already has been connected, the
          {udp, [{fd, integer()}]} option can be used to pass the
          open file descriptor to gen_udp. This can be automated
          a bit by using a command line argument stating the
          prebound file descriptor number. For example, if the
          Port is 69 and the file descriptor 22 has been opened by
          setuid_socket_wrap. Then the command line argument
          "-tftpd_69 22" will trigger the prebound file
          descriptor 22 to be used instead of opening port 69.
          The UDP option {udp, [{fd, 22}]} automatically be added.
          See init:get_argument/ about command line arguments and
          gen_udp:open/2 about UDP options.</p>
      </dd>
      <dt><strong><span class="code">{port_policy, Policy}</span></strong></dt>
      <dd>
        <p><span class="code">Policy = random | Port | {range, MinPort, MaxPort}</span>          <br>
<span class="code">Port = MinPort = MaxPort = int()</span></p>
        <p>Policy for the selection of the temporary port which is used
          by the server/client during the file transfer. It defaults to
          <span class="code">random</span> which is the standardized policy. With this
          policy a randomized free port used. A single port or a range
          of ports can be useful if the protocol should pass through a
          firewall.</p>
      </dd>
      <dt><strong><span class="code">{udp, Options}</span></strong></dt>
      <dd>
        <p><span class="code">Options = [Opt]</span> see
          <span class="bold_code"><a href="javascript:erlhref('../../../../doc/../','kernel','gen_udp.html#open-1');">gen_udp:open/2</a></span></p>
      </dd>
      <dt><strong><span class="code">{use_tsize, Bool}</span></strong></dt>
      <dd>
        <p><span class="code">Bool = bool()</span></p>
        <p>Flag for automated usage of the <span class="code">tsize</span> option. With
          this set to true, the <span class="code">write_file/3</span> client will
          determine the filesize and send it to the server as
          the standardized <span class="code">tsize</span> option. A <span class="code">read_file/3</span>
          client will just acquire filesize from the server by sending
          a zero <span class="code">tsize</span>.</p>
      </dd>
      <dt><strong><span class="code">{max_tsize, MaxTsize}</span></strong></dt>
      <dd>
        <p><span class="code">MaxTsize = int() | infinity</span></p>
        <p>Threshold for the maximal filesize in bytes. The transfer
          will be aborted if the limit is exceeded. It defaults to
          <span class="code">infinity</span>.</p>
      </dd>
      <dt><strong><span class="code">{max_conn, MaxConn}</span></strong></dt>
      <dd>
        <p><span class="code">MaxConn = int() | infinity</span></p>
        <p>Threshold for the maximal number of active connections.
          The daemon will reject the setup of new connections if
          the limit is exceeded. It defaults to <span class="code">infinity</span>.</p>
      </dd>
      <dt><strong><span class="code">{TftpKey, TftpVal}</span></strong></dt>
      <dd>
        <p><span class="code">TftpKey = string()</span>          <br>
<span class="code">TftpVal = string()</span></p>
        <p>The name and value of a TFTP option.</p>
      </dd>
      <dt><strong><span class="code">{reject, Feature}</span></strong></dt>
      <dd>
        <p><span class="code">Feature = Mode | TftpKey</span>          <br>
<span class="code"> Mode = read | write</span>          <br>
<span class="code"> TftpKey = string()</span></p>
        <p>Control which features that should be rejected. This is
          mostly useful for the server as it may restrict usage of
          certain TFTP options or read/write access.</p>
      </dd>
      <dt><strong><span class="code">{callback, {RegExp, Module, State}}</span></strong></dt>
      <dd>
        <p><span class="code">RegExp = string()</span>          <br>
<span class="code">Module = atom()</span>          <br>
<span class="code">State  = term()</span></p>
        <p>Registration of a callback module. When a file is to be
          transferred, its local filename will be matched to the regular
          expressions of the registered callbacks. The first matching
          callback will be used the during the transfer. See
          <span class="bold_code"><a href="#read_file-3">read_file/3</a></span> and
          <span class="bold_code"><a href="#write_file-3">write_file/3</a></span>.
          </p>
        <p>The callback module must implement the <span class="code">tftp</span> behavior,
          <span class="bold_code"><a href="#tftp_callback">CALLBACK FUNCTIONS</a></span>.</p>
      </dd>

   <dt><strong><span class="code">{logger, Module}</span></strong></dt>
      <dd>
        <p><span class="code">Module = module()()</span></p>

        <p>Callback module for customized logging of error, warning and
	  info messages. &gt;The callback module must implement the
	  <span class="code">tftp_logger</span> behavior,
          <span class="bold_code"><a href="#tftp_logger">LOGGER FUNCTIONS</a></span>.
          The default module is <span class="code">tftp_logger</span>.</p>
      </dd>

      <dt><strong><span class="code">{max_retries, MaxRetries}</span></strong></dt>
      <dd>
        <p><span class="code">MaxRetries = int()</span></p>

        <p>Threshold for the maximal number of retries. By default
	  the server/client will try to resend a message up to
	  <span class="code">5</span> times when the timeout expires.</p>
      </dd>
    </dl>

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

  <h3>EXPORTS</h3>
    <p><a name="start-1"><span class="bold_code">start(Options) -&gt; {ok, Pid} | {error, Reason}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Options = [option()]</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Pid = pid()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = term()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Starts a daemon process which listens for udp packets on a
	port. When it receives a request for read or write it spawns
	a temporary server process which handles the actual transfer
	of the (virtual) file.</p>
	
	<a name="read_file"></a>
      </p></div>

    <p><a name="read_file-3"><span class="bold_code">read_file(RemoteFilename, LocalFilename, Options) -&gt; {ok, LastCallbackState} | {error, Reason}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">RemoteFilename = string()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">LocalFilename = binary | string()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Options = [option()]</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">LastCallbackState = term()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = term()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Reads a (virtual) file <span class="code">RemoteFilename</span> from a TFTP
	server.</p>
	<p>If <span class="code">LocalFilename</span> is the atom <span class="code">binary</span>,
	<span class="code">tftp_binary</span> is used as callback module. It concatenates
	all transferred blocks and returns them as one single binary
	in <span class="code">LastCallbackState</span>.</p>
	<p>If <span class="code">LocalFilename</span> is a string and there are no
	registered callback modules, <span class="code">tftp_file</span> is used as
	callback module. It writes each transferred block to the file
	named <span class="code">LocalFilename</span> and returns the number of
	transferred bytes in <span class="code">LastCallbackState</span>.</p>
	<p>If <span class="code">LocalFilename</span> is a string and there are registered
	callback modules, <span class="code">LocalFilename</span> is tested against
	the regexps of these and the callback module corresponding to
	the first match is used, or an error tuple is returned if no
	matching regexp is found.</p>
      </p></div>

    <p><a name="write_file-3"><span class="bold_code">write_file(RemoteFilename, LocalFilename, Options) -&gt; {ok, LastCallbackState} | {error, Reason}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">RemoteFilename = string()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">LocalFilename = binary() | string()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Options = [option()]</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">LastCallbackState = term()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = term()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Writes a (virtual) file <span class="code">RemoteFilename</span> to a TFTP
          server.</p>
        <p>If <span class="code">LocalFilename</span> is a binary, <span class="code">tftp_binary</span> is
          used as callback module. The binary is transferred block by
          block and the number of transferred bytes is returned in
          <span class="code">LastCallbackState</span>.</p>
        <p>If <span class="code">LocalFilename</span> is a string and there are no
          registered callback modules, <span class="code">tftp_file</span> is used as
          callback module. It reads the file named <span class="code">LocalFilename</span>
          block by block and returns the number of transferred bytes
          in <span class="code">LastCallbackState</span>.</p>
        <p>If <span class="code">LocalFilename</span> is a string and there are registered
	callback modules, <span class="code">LocalFilename</span> is tested against
	the regexps of these and the callback module corresponding to
	the first match is used, or an error tuple is returned if no
	matching regexp is found.</p>
	
	<a name="info_daemons"></a>
      </p></div>

    <p><a name="info-1"><span class="bold_code">info(daemons) -&gt; [{Pid, Options}]</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">Options = [option()]</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = term()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Returns info about all TFTP daemon processes. </p>
	
	<a name="info_servers"></a>
      </p></div>

    <p><a name="info-1"><span class="bold_code">info(servers) -&gt; [{Pid, Options}]</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">Options = [option()]</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = term()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Returns info about all TFTP server processes. </p>
	
	<a name="info_pid"></a>
      </p></div>

    <p><a name="info-1"><span class="bold_code">info(Pid) -&gt; {ok, Options} | {error, Reason}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Options = [option()]</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = term()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Returns info about a TFTP daemon, server or client process.</p>
	
	<a name="change_config_daemons"></a>
      </p></div>

   <p><a name="change_config-2"><span class="bold_code">change_config(daemons, Options) -&gt; [{Pid, Result}]</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Options = [option()]</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Pid = pid()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Result = ok | {error, Reason}</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = term()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Changes config for all TFTP daemon processes. </p>
	
	<a name="change_config_servers"></a>
      </p></div>

    <p><a name="change_config-2"><span class="bold_code">change_config(servers, Options) -&gt; [{Pid, Result}]</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Options = [option()]</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Pid = pid()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Result = ok | {error, Reason}</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = term()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Changes config for all TFTP server processes. </p>
	
	<a name="change_config_pid"></a>
      </p></div>

    <p><a name="change_config-2"><span class="bold_code">change_config(Pid, Options) -&gt; Result</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">Options = [option()]</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Result = ok | {error, Reason}</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = term()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Changes config for a TFTP daemon, server or client process</p>
	
	<a name="start2"></a>
      </p></div>

    <p><a name="start-0"><span class="bold_code">start() -&gt; ok | {error, Reason}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Reason = term()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Starts the Inets application.</p>
      </p></div>
  

  <h3><a name="id79821">CALLBACK FUNCTIONS</a></h3>
<div class="REFBODY">
    <a name="tftp_callback"></a>
    
    <p>A <span class="code">tftp</span> callback module should be implemented as a
      <span class="code">tftp</span> behavior and export the functions listed below.</p>
    <p>On the server side the callback interaction starts with a call to
      <span class="code">open/5</span> with the registered initial callback state.
      <span class="code">open/5</span> is expected to open the (virtual) file. Then either
      the <span class="code">read/1</span> or <span class="code">write/2</span> functions are invoked
      repeatedly, once per transferred block. At each function call
      the state returned from the previous call is obtained. When
      the last block has been encountered the <span class="code">read/1</span> or
      <span class="code">write/2</span> functions is expected to close the (virtual) file
      and return its last state. The <span class="code">abort/3</span> function is only
      used in error situations. <span class="code">prepare/5</span> is not used on
      the server side.</p>
    <p>On the client side the callback interaction is the same, but it
      starts and ends a bit differently. It starts with a call to
      <span class="code">prepare/5</span> with the same arguments as <span class="code">open/5</span> takes.
      <span class="code">prepare/5</span> is expected to validate the TFTP options,
      suggested by the user and return the subset of them that it
      accepts. Then the options is sent to the server which will perform
      the same TFTP option negotiation procedure. The options that are
      accepted by the server are forwarded to the <span class="code">open/5</span> function
      on the client side. On the client side the <span class="code">open/5</span> function
      must accept all option as is or reject the transfer. Then
      the callback interaction follows the same pattern as described
      above for the server side. When the last block is encountered in
      <span class="code">read/1</span> or <span class="code">write/2</span> the returned state is forwarded to
      the user and returned from <span class="code">read_file</span>/3 or
      <span class="code">write_file/3</span>.</p>

    <p> If a callback (which performs the file access
    in the TFTP server) takes too long time (more than
    the double TFTP timeout), the server will abort the
    connection and send an error reply to the client.
    This implies that the server will release resources
    attached to the connection faster than before. The
    server simply assumes that the client has given
    up.</p>

    <p>If the TFTP server receives yet another request from
    the same client (same host and port) while it
    already has an active connection to the client, it
    will simply ignore the new request if the request is
    equal with the first one (same filename and options).
    This implies that the (new) client will be served
    by the already ongoing connection on the server
    side. By not setting up yet another connection, in
    parallel with the ongoing one, the server will
    consumer lesser resources. </p>
    
    <a name="prepare"></a>
  </div>

  <h3>EXPORTS</h3>
    <p><a name="prepare-6"><span class="bold_code">prepare(Peer, Access, Filename, Mode, SuggestedOptions, InitialState) -&gt; {ok, AcceptedOptions, NewState} | {error, {Code, Text}}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Peer = {PeerType, PeerHost, PeerPort}</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">PeerType = inet | inet6</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">PeerHost = ip_address()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">PeerPort = integer()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Access = read | write</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Filename = string()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Mode = string()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">SuggestedOptions = AcceptedOptions = [{Key, Value}]</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code"> Key = Value = string()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">InitialState = [] | [{root_dir, string()}]</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">NewState = term()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Code = undef | enoent | eacces | enospc</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">  | badop | eexist | baduser | badopt</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">  | int()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Text = string()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
	<p>Prepares to open a file on the client side.</p>
	<p>No new options may be added, but the ones that are present in
	<span class="code">SuggestedOptions</span> may be omitted or replaced with new
	values in <span class="code">AcceptedOptions</span>.</p>
	<p>Will be followed by a call to <span class="code">open/4</span> before any
	read/write access is performed. <span class="code">AcceptedOptions</span> is
	sent to the server which replies with those options that it
	accepts. These will be forwarded to <span class="code">open/4</span> as
	<span class="code">SuggestedOptions</span>.</p>
    
	<a name="open"></a>
      </p></div>

    <p><a name="open-6"><span class="bold_code">open(Peer, Access, Filename, Mode, SuggestedOptions, State) -&gt; {ok, AcceptedOptions, NewState} | {error, {Code, Text}}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Peer = {PeerType, PeerHost, PeerPort}</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">PeerType = inet | inet6</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">PeerHost = ip_address()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">PeerPort = integer()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Access = read | write</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Filename = string()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Mode = string()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">SuggestedOptions = AcceptedOptions = [{Key, Value}]</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code"> Key = Value = string()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">State = InitialState | term()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code"> InitialState = [] | [{root_dir, string()}]</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">NewState = term()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Code = undef | enoent | eacces | enospc</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">  | badop | eexist | baduser | badopt</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">  | int()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Text = string()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Opens a file for read or write access.</p>
        <p>On the client side where the <span class="code">open/5</span> call has been
	preceded by a call to <span class="code">prepare/5</span>, all options must be
	accepted or rejected.</p>
	<p>On the server side, where there is no preceding
	<span class="code">prepare/5</span> call, no new options may be added, but
	the ones that are present in <span class="code">SuggestedOptions</span> may be
	omitted or replaced with new values in <span class="code">AcceptedOptions</span>.</p>
    
	<a name="read"></a>
      </p></div>

    <p><a name="read-1"><span class="bold_code">read(State) -&gt; {more, Bin, NewState} | {last, Bin, FileSize} | {error, {Code, Text}}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">State = NewState = term()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Bin = binary()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">FileSize = int()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Code = undef | enoent | eacces | enospc</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">  | badop | eexist | baduser | badopt</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">  | int()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Text = string()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Read a chunk from the file.</p>
        <p>The callback function is expected to close
	the file when the last file chunk is
	encountered. When an error is encountered
	the callback function is expected to clean
	up after the aborted file transfer, such as
	closing open file descriptors etc. In both
	cases there will be no more calls to any of
	the callback functions.</p>
    
	<a name="write"></a>
      </p></div>

    <p><a name="write-2"><span class="bold_code">write(Bin, State) -&gt; {more, NewState} | {last, FileSize} | {error, {Code, Text}}</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Bin = binary()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">State = NewState = term()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">FileSize = int()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Code = undef | enoent | eacces | enospc</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">  | badop | eexist | baduser | badopt</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">  | int()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Text = string()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Write a chunk to the file.</p>
        <p>The callback function is expected to close
	the file when the last file chunk is
	encountered. When an error is encountered
	the callback function is expected to clean
	up after the aborted file transfer, such as
	closing open file descriptors etc. In both
	cases there will be no more calls to any of
	the callback functions.</p>
    
	<a name="abort"></a>
      </p></div>

    <p><a name="abort-3"><span class="bold_code">abort(Code, Text, State) -&gt; ok</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Code = undef | enoent | eacces | enospc</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">  | badop | eexist | baduser | badopt</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">  | int()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Text = string()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">State = term()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Invoked when the file transfer is aborted.</p>
        <p>The callback function is expected to clean
	up its used resources after the aborted file
	transfer, such as closing open file
	descriptors etc. The function will not be
	invoked if any of the other callback
	functions returns an error, as it is
	expected that they already have cleaned up
	the necessary resources. It will however be
	invoked if the functions fails (crashes).</p>
      </p></div>
  
  
  <h3><a name="id80352">LOGGER FUNCTIONS</a></h3>
<div class="REFBODY">
    <a name="tftp_logger"></a>
    
    
    <p>A <span class="code">tftp_logger</span> callback module should be implemented as a
    <span class="code">tftp_logger</span> behavior and export the functions listed below.</p>
    
    <a name="error_msg"></a>
    </div>

  <h3>EXPORTS</h3>
    <p><a name="error_msg-2"><span class="bold_code">error_msg(Format, Data) -&gt; ok | exit(Reason)</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Format = string()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Data = [term()]</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = term()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
	<p>Log an error message. 
	See <span class="code">error_logger:error_msg/2 for details.</span> </p>
	
	<a name="warning_msg"></a>
      </p></div>

    <p><a name="warning_msg-2"><span class="bold_code">warning_msg(Format, Data) -&gt; ok | exit(Reason)</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Format = string()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Data = [term()]</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = term()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Log a warning message. 
	See <span class="code">error_logger:warning_msg/2 for details.</span> </p>
	
	<a name="info_msg"></a>
      </p></div>

    <p><a name="info_msg-2"><span class="bold_code">info_msg(Format, Data) -&gt; ok | exit(Reason)</span></a><br></p>
<div class="REFBODY">
<p>Types:</p>
        <div class="REFTYPES">
<span class="bold_code">Format = string()</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Data = [term()]</span><br>
</div>
        <div class="REFTYPES">
<span class="bold_code">Reason = term()</span><br>
</div>
      </div>
<div class="REFBODY"><p>
        <p>Log an info message. 
	See <span class="code">error_logger:info_msg/2 for details.</span> </p>
      </p></div>
  
</div>
<div class="footer">
<hr>
<p>Copyright © 1997-2012 Ericsson AB. All Rights Reserved.</p>
</div>
</div>
</div></body>
</html>