[comp.sys.mac.misc] An FTP Primer I: The File Transfer Protocol

beausol@milton.u.washington.edu (Raymond Beausoleil) (03/08/91)

As promised, here is the first of a two-part article that I agreed to
write for Optics & Photonics News. I hadn't intended to divide it into
two parts, but I'm supposed to restrict myself to 800 words per article
(I didn't quite make it!), and the article is supposed to describe the
FTP process for the uninitiated. So, the length got a bit out of hand.
The more experienced among you will notice that I have oversimplified
and just outright omitted some things; I apologize if I have gored
your pet ox.

About 95 of you responded to my original post! Unfortunately, given
my word count restriction, I couldn't thank each and every one of
you. Instead, I acknowledged two people (Geoff Kinnel and Betsy
Richards) who offered the earliest and most complete assistance,
and Geoff Allen, who happened to post his wonderful "Answers to
Frequently Asked Questions" to comp.sys.mac.announce on essentially
the same day that my plea went out. I am quite grateful to all of
you who took the time to help me out.

If you find any factual errors in the article, then please let me
know ASAP! I am particularly concerned about my references to the
MS-DOS archives. Within a week or so, I will post Part II, wherein
I will try to provide all the latest poop on mcvert, stuffit, and
compactor.

Again, thanks in advance,

Ray Beausoleil (beausol@u.washington.edu)
----------------------------------------------------------------------

An FTP Primer I: The File Transfer Protocol

Ray Beausoleil
beausol@u.washington.edu

   Some of the most capable software packages currently available for 
microcomputers are publicly issued as either "freeware" or "shareware." 
Freeware is generously released by the author to the public domain 
without charge, while shareware is distributed under a "try before you 
buy" agreement. Copies of many of these programs are archived on mini 
and mainframe computers throughout the world. If your local Unix site is 
connected to the INTERNET, then you may transfer these files to your 
site and download them to your microcomputer. 

   FTP is the user interface to the INTERNET standard File Transfer 
Protocol. This program allows you to transfer files to and from a remote 
network host. This article necessarily cannot serve as an exhaustive 
description of the "anonymous FTP" process. However, in Part I I will 
give an example of a typical FTP session, and I will list the addresses 
of a few archive sites for Macintosh and MS-DOS software. Next month, in 
Part II, I will describe some of the techniques for first decoding and 
then downloading this software to your microcomputer.

   FTP is a privilege granted to users of the INTERNET by the 
administrators of sites containing these archives. Please try to 
restrict your file transfers to non-business hours, because you and 
other FTP users can cause the host computer to slow down significantly. 
In addition, please minimize the time that you are connected to the 
remote site so that others may take advantage of the opportunity.

   A screen capture of a typical (brief) FTP session is shown in Fig. 1. 
From a Unix machine at the University of Washington ("milton"), I 
connected to sumex-aim.stanford.edu, where a large collection of 
Macintosh software is archived. The numbers in parentheses located on 
the left margin of Fig. 1 correspond to the annotations listed below.

(1)	At your Unix prompt, enter "ftp" followed by a space and either 
the name or the numerical INTERNET address of the remote host. 
Occasionally, a host will accept only the INTERNET address.

(2)	When the remote machine asks for your name, enter "anonymous." 
Some hosts limit the number of off-site FTP users; if the number of 
connections has already reached the maximum, you will be asked to try 
again later.

(3)	For your password, you are generally asked to enter your e-mail 
address, such as "beausol@u.washington.edu," followed by a return. 
However, some systems will permit you to enter virtually any text 
instead.

(4)	After these preliminaries, you will enter the FTP command 
interpreter (or "server"), which will provide you with the "ftp>" 
prompt. Usually, you will first be logged in to a "root directory" that 
has been set aside for FTP purposes by the system administrators; you 
must then navigate to the archive itself. At sumex-aim.stanford.edu, the 
macintosh software archive is located in the directory "info-mac." You 
can change the current working directory on the remote host using the 
"cd" command. In the example of Fig. 1, I have also moved to the 
subdirectory "util" on the info-mac directory. Whenever you have 
finished with a particular subdirectory, enter "cdup" at the "ftp>" 
prompt to move up one directory level. 

(5)	Enter "get" followed by a space and the name of the file to be 
transferred. The file will then be copied to your local Unix directory. 
In the example of Fig. 1, the ".hqx" extension indicates that the 
Macintosh file has been encoded as purely ASCII characters using BinHex 
(discussed in more detail in Part II.) Usually, ASCII is the default FTP 
transfer mode. However, if the file has been archived in binary format, 
then at the "ftp>" prompt, and prior to transferring the file, you must 
enter "binary." Sometimes, if the file is large and the remote system is 
busy, the transfer may take considerable time. To keep an eye on the 
progress of the transfer, enter "hash" before getting the file; then as 
each 1024-byte block of data is transferred, a "#" hash mark will be 
printed on your monitor. If you would like to see an abbreviated list of 
the files contained in the current directory, enter "ls"; for a more 
verbose list that includes information about each file's size and the 
date that it was archived, enter "dir" followed by a carriage return.

(6)	When you are finished transferring the files you need, be 
courteous and log off of the remote machine as quickly as possible. At 
the "ftp>" prompt, enter either "by" or "qui."

These are the most basic commands that you will use during any FTP 
session. You can usually find a complete description of the FTP command 
interpreter used at your Unix site by viewing the "manual pages" (i.e., 
by entering "man ftp").

There are a number of archives of software for the Macintosh, IBM PC and 
compatibles, and other popular personal computers. In Table I, I have 
listed the name of the host, the Internet address, the directory 
containing the archive, the microcomputer, and the appropriate transfer 
mode for some of the most popular archives. (Of course, virtually all 
documentation files are stored as pure ASCII.) One of the largest and 
most frequently updated Macintosh software archives is maintained at 
sumex-aim.stanford.edu. I recommend that the inexperienced user explore 
the subdirectory /info-mac/help. OzTeX, the free Macintosh 
implementation of TeX mentioned by Tony Siegman in last month's column, 
may be found at midway.uchicago.edu (University of Chicago); it is quite 
large, so be prepared! The MS-DOS archive at wsmr-simtel20.army.mil 
(White Sands Missile Range) is enormous, but it is difficult to navigate 
because the host does not use Unix. Nevertheless, there are a number of 
text documents in the root directory that describe the FTP commands for 
the simtel20 server. A Unix mirror of the simtel20 archive is maintained 
at wuarchive.wustl.edu (Washington University at St. Louis); if you are 
new to FTP on the IBM PC, then an excellent place to begin is the 
wuarchive subdirectory /mirrors/msdos/starter.

The best way to learn more about FTP and other microcomputer archives is 
to subscribe to the appropriate INTERNET news groups. A full description 
of INTERNET news groups is beyond the scope of this article; you'll need 
to list the manual pages for your system news reader or to contact your 
local system administrator to get started. However, news groups of 
interest to microcomputer users have names that begin with prefixes like 
"comp.sys.mac..." and "comp.sys.ibm.pc..." In particular, the news 
groups "comp.sys.mac.digest" and "comp.sys.ibm.pc.d" describe in detail 
new additions to the archives at sumex-aim and simtel20, respectively.

The precise implementation of FTP is site-dependent, so "your mileage 
may vary." But the basics of file transfer are usually easy to master 
and are well worth the effort. Next month, I will describe the basics of 
decoding and downloading files obtained via FTP.

(I am grateful to Geoff Kinnel, Betsy Richards, and Geoff Allen for 
their generous assistance in gathering information for this article.)

Figure 1: Screen Capture of an ftp session.

(1)	milton> ftp 36.44.0.6
	Connected to 36.44.0.6.
	220 sumex-aim FTP server (SunOS 4.0/3) ready.
(2)	Name (36.44.0.6:beausol): anonymous
	331 Guest login ok, send mail address (user@host) as password.
(3)	Password:
	230 Guest connection 7 (of 25) accepted, access restrictions 
	apply.
(4)	ftp> cd /info-mac/util
	250 CWD command successful.
(5)	ftp> get unstuffit-deluxe-20.hqx
	200 PORT command successful.
	150 ASCII data connection for unstuffit-deluxe-20.hqx
	(128.95.136.1,11969) (172867 bytes).
	226 ASCII Transfer complete.
	local: unstuffit-deluxe-20.hqx remote: unstuffit-deluxe-20.hqx
	175534 bytes received in 7.2 seconds (24 Kbytes/s)
(6)	ftp> bye
	221 Goodbye.


Table I:

Site Name               IP Address      Directory     Software   Mode
----------------------------------------------------------------------
sumex-aim.stanford.edu  36.44.0.6	/info-mac        Mac      ASCII
midway.uchicago.edu     128.135.12.73   /pub/OzTeX/oztex Mac      Binary
wsmr-simtel20.army.mil  26.2.0.74       Non-Unix!        MS-DOS   Binary
wuarchive.wustl.edu     128.252.135.4   /mirrors/msdos   MS-DOS   Binary