TFTP.COM is an implementation of the "Trivial File Transfer Protocol" for
DOS, allowing easy transfer of files between a DOS system and any system
supporting this protocol - compatible TFTP clients/servers are available
for Linux, OS-X, Windows and many other operating platforms.

TFTP.COM uses a DOS-standard "crynwar" packet driver for the network
interface. Crynwar packet drivers are available for many network cards.
See www.crynwar.com (many network cards from the DOS era included Crynwar
compatible packet drivers with the install package).


Use: TFTP  n.n.n.n  GET|PUT filename [remote-filename] [options]
     TFTP [n.n.n.n] SERVER [options]

opts: /A         - Ascii transfer mode                    [binary]
      D=xx       - packet Driver interrupt (hex)          [60]
      G=n.n.n.n  - set Gateway ip address                 [none]  (see note)
      L=n.n.n.n  - set Local   ip address                 [DHCP/BOOTP]
      M=GEDATIP  - detail Message output                  [GE]
                   General Errors Dhcp Arp Tftp Ip/udp Packet
      I=n        - Ip port(s) to use/assign               [4096]
      P=n        - tftp Port                              [69]
      T=n        - client-response/server-session Timeout [20/100] (.1sec)

- You may preset arguments in TFTP= environment variable (use ~ for =).
- server/gateway IP can be .n[.n[.n]] upper digits are same as local ip.
- No subnet routing is performed - If gateway is defined, ALL get/put
  requests are sent through it. Define gateway only for non-local transfers.

Copyright 2008-2010 Dave Dunfield - All rights reserved.


Any command input can be preset in the environment variable "TFTP=". This
will be processed BEFORE actual arguments supplied to the TFTP command.
Since DOS does not allow '=' in environment variables, use the '~' character
in it's place. eg:

SET TFTP=192.168.1.50 L~192.168.1.10 G~192.168.1.1 T~150 /A
 - Preset server IP to:        192.168.1.50
 - Preset local (static) IP to 192.168.2.10
 - Preset gateway IP to        192.168.2.1
 - Preset response timeout to  15 seconds
 - Preset ASCII transfers


TFTP.COM operates in two basic modes, "client" in which it is used to
initiate file transfers with a TFTP server, and "server" in which it
responds to file transfers initiated by TFTP clients.


CLIENT mode:

Client mode is established by the keyword "GET" or "PUT". "GET" performs
a file transfer from the server (remote) to the client (local). "PUT"
performs a file transfer from the client (local) to the server (remote).
After the GET/PUT transaction is completed, TFTP.COM will terminate.

You must supply the server IP address n.n.n.n before GET/PUT - if you
are doing many transactions with a single server, you can avoid having
to enter it every time by presetting it in the TFTP= evironment variable.


SERVER mode:

Server mode is established with the keyboard "SERVER" - you may optionally
preceed this with the local (static) ip address, otherwise TFTP.COM will
obtain one via DHCP/BOOTP (or use a static ip address preset with 'L=').

Once server mode is started, it will remain active and respond to TFTP
requests until you press the ESCape key - which will cause the server to
terminate. The TFTP directory accessed by server mode is the DOS current
directory where the server was started.


Options:

/A - Ascii mode (client only)

 Causes TFTP.COM to GET/PUT files in NETASCII format - this performs a
 translation between systems which have different text file formats. If
 this option is NOT given, files are transferred in binary mode (also
 called OCTET mode) in which no translation is performed, and the file
 is transferred in it's exact binary format.

 /A is effective for client mode only. Server mode determines the
 transfer type from the incoming TFTP request.


D=xx - packet Driver interrupt

 Specifies the software interrupt (in hex) on which the packet driver has
 been installed. Normally this is 60, however you may wish to use a different
 interrupt if you have multiple network interfaces/packet drivers in use.


G=n.n.n.n - set Gateway ip address (client only)

 If this option is supplied, TFTP.COM will attempt to route all GET/PUT
 requests through the specified gateway address. This is used to perform
 transfers with servers which are not on the local subnet. Note that this
 simple implementation does NOT perform automatic routing based on a subnet
 mask - if you specify G=, ALL requests will be routed through the gateway.


L=n.n.n.n - set Local ip address

 If this option is supplied, the specified static IP address will be used
 for the local service. If not supplied, TFTP.COM will try to obtain an
 IP address via DHCP/BOOTP.


M=GEDATIP - set output Message detail

 This option controls messages output to the DOS console during operation,
 and is mainly used for debugging network connection problems.
    G = General progress messages
    E = Error messages
    D = DHCP detail messages
    A = ARP detail messages
    T = TFTP protocol detail messages
    I = IP/UDP protocol detail messages
    P = PACKET driver detail messages


I=n - Ip port(s) to use/assign

 Defines the ip port that TFTP.COM will use for handed off sessions.
 In client mode, only the one port is used, and it will be specified
 in the request packet to direct responses there.

 In server mode, ports will be assigned to incoming requests starting
 with this value up to the number of concurrent TFTP sessions.


P=n - tftp request Port

 Defines the ip port where TFTP requests are initiated. For client mode,
 this defines the port on which the request will be sent. For server mode,
 this defines the port where the server listens for new requests.

 TFTP normally sends/expects requests on port 69 - however this option
 allows you to use non-standard ports if you have reason to do so.


T=n - client-response/server-session Timeout

 Defines the timeouts used by the client or server. In either case, time
 value is specified in multiples of 0.1 second (ie: 100 = 10 seconds).

 This defines the amount of time the client will wait for a response before
 assuming a packet was lost in transit and attempt a retry.

 This defines how long the server waits for activity in a session before
 disconnecting that session. NOTE that the server holds the session open
 for this long following the final transmission allowing the client time
 to request a retransmit of that final packet.

 The default values are fairly short to expedite file transfers over a local
 network - you may need to increase these values when operating through a
 gateway and busy networks.


Misc. notes:

TFTP.COM contains it's own ip/udp "stack", and therefore does not require
ANY support software other than the packet driver for the network card.

TFTP.COM implements only the original TFTP specification with 512 byte
packet lengths, which limits the size of a file which can be transferred
to 32 Megs - this is not normally a problem in DOS usage.

Due to the complete lack of security in TFTP, some (many) servers have
restrictions on allowed transfers - for example, you may only be able to
PUT new files, or in some cases only PUT files that already exist
(ie: cannot create new files).

The server within TFTP.COM does not apply restrictions on file transfers.
You may GET/PUT any valid DOS file. (This can be a security concern, however
TFTP.COM is not envisioned as a full-time server - it is intended as
something you use do a few monitored transfers over a local network and
then shut down, which would present very low risk).

SERVER mode supports up to 10 concurrent TFTP sessions.


Dunfield Development Services (DDS) offers software and firmware
development services specializing in systems and embedded applications.
For more information, visit: http://www.dunfield.com
