The initiating host A sends an RRQ (read request) or WRQ (write request) packet to host S at port number 69, containing the filename, transfer mode, and optionally any negotiated option under the terms of RFC 2347.The ports are chosen at random according to the parameters of the networking stack, typically from the range of ephemeral ports. A transfer request is always initiated targeting port 69, but the data transfer ports are chosen independently by the sender and receiver during the transfer initialization. RFC 1350 declared this mode of transfer obsolete. Mail transfer mode uses Netascii transfer, but the file is sent to an email recipient by specifying that recipient's email address as the file name.More correctly, if a host receives an octet file and then returns it, the returned file must be identical to the original.
Octet allows for the transfer of arbitrary raw 8-bit bytes, with the received file resulting byte-per-byte identical to the one sent.Netascii also requires that the end of line marker on a host be translated to the character pair CR LF for transmission, and that any CR must be followed by either a LF or the null. The allowed control characters include the null (0x00), the line feed (LF, 0x0A), and the carriage return (CR, 0x0D). It consists of an 8-bit extension of the 7-bit ASCII character space from 0x20 to 0x7F (the printable characters and the space) and eight of the control characters. Netascii is a modified form of ASCII, defined in RFC 764.TFTP defines three modes of transfer: netascii, octet, and mail. One sends data and receives acknowledgments, the other sends acknowledgments and receives data.
Notice that both devices involved in a transfer are considered senders and receivers. The sender has to keep just one packet on hand for retransmission, since the lock step acknowledgment guarantees that all older packets have been correctly received. If a packet gets lost in the network, the intended recipient will timeout and may retransmit their last packet (which may be data or an acknowledgment), thus causing the sender of the lost packet to retransmit that lost packet. A data packet of less than 512 bytes or the agreed blocksize option signals termination of a transfer. Each block of transferred data, which is usually carried within a single IP packet in order to avoid IP fragmentation, must be acknowledged by an acknowledgment packet before the next block can be sent. If the server grants the request, the file is sent in fixed length blocks of 512 bytes by default or the number specified in the blocksize negotiated option defined by RFC 2348. The request can optionally include a set of negotiated transfer parameters proposed by the client under the terms specified by RFC 2347. In TFTP, a transfer is initiated by the client issuing a request to read or write a particular file on the server. Today TFTP is generally only used on local area networks (LAN). It cannot list, delete, or rename files or directories and it has no provisions for user authentication. TFTP only reads and writes files from or to a remote server. TFTP was designed to be small and easy to implement, and therefore it lacks most of the advanced features offered by more robust file transfer protocols. TFTP is a simple protocol for transferring files, implemented on top of the UDP/IP protocols using well-known port number 69. In March 1995 the TFTP Option Extension RFC 1782 updated later in May 1998 by RFC 2347, defined the option negotiation mechanism which establishes the framework for file transfer options to be negotiated prior to the transfer using a mechanism which is consistent with TFTP's original specification. In June 1981 The TFTP Protocol (Revision 2) was published as RFC 783 and later updated in July 1992 by RFC 1350 which fixed among other things the Sorcerer's Apprentice Syndrome. TFTP was first defined in 1980 by IEN 133. TFTP's design was influenced from the earlier protocol EFTP, which was part of the PARC Universal Packet protocol suite. Today, TFTP is virtually unused for Internet transfers. It is also used to transfer firmware images and configuration files to network appliances like routers, firewalls, IP phones, etc. It is therefore the protocol of choice for the initial stages of any network booting strategy like BOOTP, PXE, BSDP, etc., when targeting from highly resourced computers to very low resourced Single-board computers (SBC) and System on a Chip (SoC).
Due to its simple design, TFTP can be easily implemented by code with a small memory footprint.