This is a complete implementation of the following IETF standards:
The only feature that not is implemented in this release is the "netascii" transfer mode.
The
On the client side
the
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
The TFTP server can be stopped using
The TPFT client is of such a temporary nature that it is not handled as a service in the Inets service framework.
ServiceConfig = Options Options = [option()] option() -- see below
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:
Controls the level of debug printouts. The default is
The name or IP address of the host where the TFTP daemon resides. This option is only used by the client.
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
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.
Policy for the selection of the temporary port which is used
by the server/client during the file transfer. It defaults to
Flag for automated usage of the
Threshold for the maximal filesize in bytes. The transfer
will be aborted if the limit is exceeded. It defaults to
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
The name and value of a TFTP option.
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.
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
The callback module must implement the
Callback module for customized logging of error, warning and
info messages. >The callback module must implement the
Threshold for the maximal number of retries. By default
the server/client will try to resend a message up to
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.
Reads a (virtual) file
If
If
If
Writes a (virtual) file
If
If
If
Returns info about all TFTP daemon processes.
Returns info about all TFTP server processes.
Returns info about a TFTP daemon, server or client process.
Changes config for all TFTP daemon processes.
Changes config for all TFTP server processes.
Changes config for a TFTP daemon, server or client process
Starts the Inets application.
A
On the server side the callback interaction starts with a call to
On the client side the callback interaction is the same, but it
starts and ends a bit differently. It starts with a call to
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.
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.
Prepares to open a file on the client side.
No new options may be added, but the ones that are present in
Will be followed by a call to
Opens a file for read or write access.
On the client side where the
On the server side, where there is no preceding
Read a chunk from the file.
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.
Write a chunk to the file.
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.
Invoked when the file transfer is aborted.
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).
A
Log an error message.
See
Log a warning message.
See
Log an info message.
See