(Latest Revision:
Wed May 02 01:06 2007
)
Notes On Chapter Thirty-Four
-- File Transfer and Remote File Access
34.1 Introduction
- File Transfer Protocol (FTP) is well established software that uses
the client-server paradigm
34.2 Generalized File Transfer
- In the early days of networking it quickly became apparent that
there is a need for general file transfer
software that can transfer files of various types between
computers of various kinds.
- Complications:
- conventions for naming files vary.
- file formats, protection methods, and data
representation vary.
34.3 The File Transfer Protocol (FTP)
- FTP:
- deals well with differences between
computing systems,
- permits transfer of arbitrary data, and
- deals well with file permissions and ownership.
- FTP has been around longer than IP or TCP.
34.4 FTP General Model and User Interface
- There are many different programs that use FTP.
(You have to make a distinction between program named "ftp"
and the protocol itself "FTP.")
- FTP accommodates both batch and interactive styles of file transfer,
but it is most commonly used interactively.
- A program can run FTP code without intervention
of a user.
34.5 FTP Commands
- Many FTP programs are based on the old BSD unix version of the file
transfer program (ftp)
- Figure 34.1 on page 515 of the fourth edition lists the commands
provided by BSD ftp:
34.6 Connections, Authorization, and File Permission
- A user of FTP has to login as a user on the
remote machine.
- After this authentication FTP establishes a control connection
between the client and server.
- The client uses the control connection to send
commands to the server.
34.7 Anonymous File Access
- There is a special mode of FTP use where the
user logs in as "anonymous" (usually the alias "ftp" is
accepted.)
- Access is granted with no password, or
just by requiring the user to enter an e-mail address.
- Anonymous FTP is useful for allowing users to
download material that is "posted" in a public area.
34.8 File Transfer In Either Direction
- One can transfer files from local to remote with send, put, or mput.
- One can transfer files from remote to local with get or mget.
34.9 Wildcard Expansion in File Names
- One may use wildcard characters with
mput or mget.
34.10 File Name Translation
- Sometimes when we transfer files from one computer to another, we
need to change the names of files because of incompatible naming
rules. BSD ftp has commands for specifying how names should be
changed. For example you can use mget with a wildcard and all the
filenames will be mapped from lower-case to upper-case and/or
extensions of .txt will be changed to .ASC.
34.11 Changing Directories and Listing Contents
- To allow users to deal with the directory system on the remote
computer, FTP supports pwd,
cd, cdup, dir, and ls commands.
34.12 File Types and Transfer Modes
- FTP can transfer in text mode or binary mode.
- Text mode is for files that consist solely of
sequences of characters separated into lines.
- Binary mode is for everything else.
- Text mode will handle translation
between text representation differences between machines. For
example it will substitute the linefeed only convention of unix for
the carriage-return, linefeed convention of DOS and Windows.
- Binary mode does no translation -- just
transfers bit-for-bit.
34.13 Example FTP Session
- The example is on pages 520-522 of the fourth edition. Try it!
34.14 Verbose Output
- ftp has a verbose command that toggles verbose and quiet
modes.
34.15 Client-Server Interaction in FTP
- The client does not just pass all the characters typed by the user
to the server.
- The client interprets what the user types and
sends commands to the server (when necessary) that achieve the
result desired by the user.
- The client and server communicate using the
language of FTP -- the protocol.
34.16 Control and Data Connections
- For each file transfer the client and the
server form a separate connection -- distinct from the
original control connection.
- The control connection persists for the
duration of a session (what happens between an open and a
close) but each data connection is terminated after transferring one
file.
- The FTP server on the remote host acts as a
client when it opens a data connection back to the local
host.
34.17 Data Connections And End Of File
- Advantages of having separate control and data
connections:
- Implementation is simple - no problem
distinguishing data from control commands.
- Client can control the file transfer
interactively -- for example s/he can send an abort
command in the middle of the transfer.
- The sender does not have to state the size
of the file before starting the transfer.
The sender may write to the end of the file while the
(beginning of) the file is being transferred.
The sender closes the data connection to
signal that the transfer has completed. The receiver
gets the end-of-file condition from the underlying protocol.
34.18 Trivial File Transfer Protocol
- TFTP is Trivial File Transfer Protocol.
- TFTP uses UDP and FTP uses TCP.
- TFTP is not interactive.
- TFTP can only get public files that it already "knows about."
- TFTP software can be small enough so that TFTP,
UDP, and IP will all fit in ROM.
- Diskless workstations commonly use TFTP when
they boot.
- A ROM program in the client broadcasts a request, establishes a
connection with a boot server, uses TFTP to
download an image of an OS, and executes the OS.
- It can be cost-effective to use diskless clients that mount file
systems from file servers.
- It is easy to "upgrade" the OS of a large number of diskless
workstations. Just change the software they download from the boot
server.
34.19 Network File System
- NFS uses UDP to transfer file blocks across a
network between a client host and a server.
- NFS makes it possible for a client to mount a
remote file system onto an arbitrary location in its
directory "tree."
- NFS is an alternative to FTP. NFS is for
block-at-a-time transfers while FTP is oriented towards
transferring whole files.
34.20 Summary