1.2.1.23.1 Abstraction Model

The TFTP communication is based on a client/server model. The process of transferring a file consists of three main phases. In highly generalized terms, these phases are:

  • Initial Connection:
    • The TFTP client establishes the connection by sending an initial request to the server.
    • The server responds back to the client and the connection is effectively opened.
  • Data Transfer:
    • Once the connection has been established, the client and server exchange TFTP messages. One device sends data and the other sends acknowledgments.
  • Connection Termination:
    • When the last TFTP message containing data has been sent and acknowledged, the connection is terminated.

How the Library Works

Any transfer begins with a request from a client to read or write a file. If the server grants the request, the connection is opened and the file is sent usually in fixed length blocks of 512 bytes. Each data packet contains one block of data, and must be acknowledged by an acknowledgment packet before the next packet can be sent. A data packet of less than 512 bytes, signals termination of a transfer. If a packet gets lost in the network, the intended recipient will time out and may retransmit the last packet (which may be data or an acknowledgment), thus causing the sender of the lost packet to retransmit that lost packet.

TFTP Transfer Set up

  • To set up a TFTP transfer, a TFTP client device can request (get) files from the server and also transfer (put) files to the server.
  • The File System on the server is transparent. Currently the Microchip Harmony devices support MPFS or FAT file systems.
  • The Microchip TFTP server implementation allows the user to start and stop the service dynamically by using the TFTP Application Programming Interface ( API) function.

TFTP Transfer Options

The following options are supported in the current TFTP server implementation (see RFC 2348, 2349):

TFTP Option NameTFTP Option Code (Used in Request Messages)Description
Block SizeblksizeThe option allows the Client and the Server to send data blocks of a size different than 512 bytes
Timeout IntervalintervalThe option permits the client /server to agree on a specified number of seconds to use for their retransmission.
Transfer SizetsizeThe option allows the side receiving the file to determine the ultimate size of the transfer before it begins.

TFTP Client Server Communication

TFTP Write Request (WRQ)

The following diagram illustrates a write request

TFTP Read Request (RRQ)

The following diagram illustrates a read request

Flow chart for the TFTP server processing incoming requests