Sophie

Sophie

distrib > Mageia > 6 > x86_64 > media > core-updates > by-pkgid > eb1ec8bb814fe4d749258d46ae8ea988 > files > 787

erlang-doc-18.3.2-9.1.mga6.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-6.2.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 6.2.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="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-0"><a href="inets.html#stop-0">stop/0</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="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="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="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="read_file-3"><a href="tftp.html#read_file-3">read_file/3</a></li>
<li title="start-1"><a href="tftp.html#start-1">start/1</a></li>
<li title="write_file-3"><a href="tftp.html#write_file-3">write_file/3</a></li>
<li title="Module:abort-3"><a href="tftp.html#Module:abort-3">Module:abort/3</a></li>
<li title="Module:open-6"><a href="tftp.html#Module:open-6">Module:open/6</a></li>
<li title="Module:prepare-6"><a href="tftp.html#Module:prepare-6">Module:prepare/6</a></li>
<li title="Module:read-1"><a href="tftp.html#Module:read-1">Module:read/1</a></li>
<li title="Module:write-2"><a href="tftp.html#Module:write-2">Module:write/2</a></li>
<li title="Logger:error_msg-2"><a href="tftp.html#Logger:error_msg-2">Logger:error_msg/2</a></li>
<li title="Logger:info_msg-2"><a href="tftp.html#Logger:info_msg-2">Logger:info_msg/2</a></li>
<li title="Logger:warning_msg-2"><a href="tftp.html#Logger:warning_msg-2">Logger:warning_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="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="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="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="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>
<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="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="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="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="stream_next-1"><a href="httpc.html#stream_next-1">stream_next/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>
</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="info-4"><a href="httpd.html#info-4">info/4</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:remove-1"><a href="httpd.html#Module:remove-1">Module:remove/1</a></li>
<li title="Module:store-2"><a href="httpd.html#Module:store-2">Module:store/2</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_custom_api " expanded="false">httpd_custom_api<ul>
<li><a href="httpd_custom_api.html">
                  Top of manual page
                </a></li>
<li title="response_default_headers-0"><a href="httpd_custom_api.html#response_default_headers-0">response_default_headers/0</a></li>
<li title="response_header-1"><a href="httpd_custom_api.html#response_header-1">response_header/1</a></li>
<li title="request_header-1"><a href="httpd_custom_api.html#request_header-1">request_header/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="day-1"><a href="httpd_util.html#day-1">day/1</a></li>
<li title="decode_hex-1"><a href="httpd_util.html#decode_hex-1">decode_hex/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_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="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_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="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="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_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="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_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="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="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="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="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="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="Module:event-4"><a href="mod_security.html#Module:event-4">Module:event/4</a></li>
<li title="Module:event-5"><a href="mod_security.html#Module:event-5">Module: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="decode-1"><a href="http_uri.html#decode-1">decode/1</a></li>
<li title="encode-1"><a href="http_uri.html#encode-1">encode/1</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="scheme_defaults-0"><a href="http_uri.html#scheme_defaults-0">scheme_defaults/0</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 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 listening for UDP packets on a port. When it
      receives a request for read or write, it spawns a temporary server
      process handling the transfer.</p>
    <p>On the client side,
      function <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>
      spawn a temporary client process establishing
      contact with a TFTP daemon and perform the file transfer.</p>
    <p><span class="code">tftp</span> uses a callback module to handle the 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 details.
      You can also implement your own callback modules, see 
      <span class="bold_code"><a href="#tftp_callback">CALLBACK FUNCTIONS</a></span>. 
      A callback module provided by
      the user is registered using option <span class="code">callback</span>, see
      <span class="bold_code"><a href="#options">DATA TYPES</a></span>.</p>
  </p></div>
  
 <h3><a name="idp295522420">TFTP SERVER SERVICE START/STOP</a></h3>
<div class="REFBODY">
    
    
    <p>A TFTP server can be configured to start statically when starting
      the <span class="code">Inets</span> application. Alternatively, it can be started dynamically
      (when <span class="code">Inets</span> is already started) by calling the <span class="code">Inets</span> 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 in
      the <span class="bold_code"><a href="#options">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 <span class="code">Inets</span> service framework.</p>
    
  </div>
  
  <h3><a name="idp295527188">DATA TYPES</a></h3>
<div class="REFBODY">
    <a name="options"></a>
    
    <p><span class="code">ServiceConfig = Options</span></p>
    <p><span class="code">Options = [option()]</span></p>
    <p>Most of the options are common for both the client and the server
      side, but some of them differs a little. 
      The available <span class="code">option()</span>s are as follows:</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. 
	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. Defaults is
          the standardized number 69. On the server side, it can
          sometimes make sense to set it to 0, meaning that
          the daemon just picks a free port (which one is
          returned by function <span class="code">info/1</span>).</p>
        <p>If a socket is connected already, option
          <span class="code">{udp, [{fd, integer()}]}</span> can be used to pass the
          open file descriptor to <span class="code">gen_udp</span>. This can be automated
          by using a command-line argument stating the
          prebound file descriptor number. For example, if the
          port is 69 and file descriptor 22 is opened by
          <span class="code">setuid_socket_wrap</span>, the command-line argument
          "-tftpd_69 22" triggers the prebound file
          descriptor 22 to be used instead of opening port 69.
          The UDP option <span class="code">{udp, [{fd, 22}]}</span> is automatically added.
          See <span class="code">init:get_argument/</span> about command-line arguments and
          <span class="code">gen_udp:open/2</span> 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></p>
	<p><span class="code">Port = MinPort = MaxPort = int()</span></p>
        <p>Policy for the selection of the temporary port that is used
          by the server/client during the file transfer. Default is
          <span class="code">random</span>, which is the standardized policy. With this
          policy a randomized free port is used. A single port or a range
          of ports can be useful if the protocol passes 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 use of option <span class="code">tsize</span>. With
          this set to <span class="code">true</span>, the <span class="code">write_file/3</span> client
          determines the filesize and sends it to the server as
          the standardized <span class="code">tsize</span> option. A <span class="code">read_file/3</span>
          client acquires only a 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
          is aborted if the limit is exceeded. 
	  Default is <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 rejects the setup of new connections if
          the limit is exceeded. Default is <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>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>Controls which features to reject. This is
          mostly useful for the server as it can restrict the use
	  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 is matched to the regular
          expressions of the registered callbacks. The first matching
          callback is used 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, see
          <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 errors, warnings, and
	  info messages. The callback module must implement the
	  <span class="code">tftp_logger</span> behavior, see
          <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 tries to resend a message up to
	  five times when the time-out expires.</p>
      </dd>
    </dl>
  </div>

  <h3>EXPORTS</h3>
    <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 configuration for all TFTP daemon processes. </p>
      </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 configuration for all TFTP server processes.</p>
      </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 configuration for a TFTP daemon, server, or client process.</p>
      </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 information about all TFTP daemon processes.</p>
      </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 information about all TFTP server processes. </p>
      </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 information about a TFTP daemon, server, or client process.</p>
      </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="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 listening for UDP packets on a
	port. When it receives a request for read or write, it spawns
	a temporary server process handling the actual transfer
	of the (virtual) file.</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>
      </p></div>
  

  <h3><a name="idp295583604">CALLBACK FUNCTIONS</a></h3>
<div class="REFBODY">
    <a name="tftp_callback"></a>
    
    <p>A <span class="code">tftp</span> callback module is to be implemented as a
      <span class="code">tftp</span> behavior and export the functions listed
      in the following.</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
      function <span class="code">read/1</span> or <span class="code">write/2</span> is invoked
      repeatedly, once per transferred block. At each function call,
      the state returned from the previous call is obtained. When
      the last block is encountered, function <span class="code">read/1</span> or
      <span class="code">write/2</span> is expected to close the (virtual) file
      and return its last state. Function <span class="code">abort/3</span> is only
      used in error situations. Function <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 to return the subset of them that it
      accepts. Then the options are sent to the server, which performs
      the same TFTP option negotiation procedure. The options that are
      accepted by the server are forwarded to function <span class="code">open/5</span>
      on the client side. On the client side, function <span class="code">open/5</span>
      must accept all option as-is or reject the transfer. Then
      the callback interaction follows the same pattern as described
      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 (performing the file access
    in the TFTP server) takes too long time (more than
    the double TFTP time-out), the server aborts the
    connection and sends an error reply to the client.
    This implies that the server releases 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
    ignores the new request if the request is
    equal to 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
    consumes less resources.</p>
    
    <a name="prepare"></a>
  </div>

  <h3>EXPORTS</h3>
     <p><a name="Module:abort-3"><span class="bold_code">Module: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 and so on. The function is not
	invoked if any of the other callback
	functions returns an error, as it is
	expected that they already have cleaned up
	the necessary resources. However, it is
	invoked if the functions fail (crash).</p>
      </p></div>
    
      <p><a name="Module:open-6"><span class="bold_code">Module: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 can be added, but
	those present in <span class="code">SuggestedOptions</span> can be
	omitted or replaced with new values in <span class="code">AcceptedOptions</span>.</p>
    
	<a name="read"></a>
      </p></div>
    
    <p><a name="Module:prepare-6"><span class="bold_code">Module: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 can be added, but those present in
	<span class="code">SuggestedOptions</span> can be omitted or replaced with new
	values in <span class="code">AcceptedOptions</span>.</p>
	<p>This is 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 the options that it
	accepts. These are then forwarded to <span class="code">open/4</span> as
	<span class="code">SuggestedOptions</span>.</p>
    
	<a name="open"></a>
      </p></div>

    <p><a name="Module:read-1"><span class="bold_code">Module: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>Reads 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, and so on. 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="Module:write-2"><span class="bold_code">Module: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>Writes 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, and so on. In both
	cases there will be no more calls to any of
	the callback functions.</p>
    
	<a name="abort"></a>
      </p></div>
  
  
  <h3><a name="idp295618644">LOGGER FUNCTIONS</a></h3>
<div class="REFBODY">
    <a name="tftp_logger"></a>
    
    
    <p>A <span class="code">tftp_logger</span> callback module is to be implemented as a
    <span class="code">tftp_logger</span> behavior and export the following functions:</p>
    
    <a name="error_msg"></a>
    </div>

  <h3>EXPORTS</h3>
    <p><a name="Logger:error_msg-2"><span class="bold_code">Logger: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>Logs an error message. 
	See <span class="code">error_logger:error_msg/2</span> for details.</p>
	
	<a name="warning_msg"></a>
      </p></div>

    <p><a name="Logger:info_msg-2"><span class="bold_code">Logger: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>Logs an info message. 
	See <span class="code">error_logger:info_msg/2</span>  for details.</p>
      </p></div>
    
    <p><a name="Logger:warning_msg-2"><span class="bold_code">Logger: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>Logs a warning message. 
	See <span class="code">error_logger:warning_msg/2</span> for details.</p>
	
	<a name="info_msg"></a>
      </p></div>
  
</div>
<div class="footer">
<hr>
<p>Copyright © 1997-2018 Ericsson AB. All Rights Reserved.</p>
</div>
</div>
</div></body>
</html>