Академический Документы
Профессиональный Документы
Культура Документы
Understanding TCP/IP
TCP/IP, the ubiquitous network protocol, is actually a four-layer suite of protocols and is well
worth gaining an understanding of. The third instalment of our four-part article.
By Julian Moss
File: C04100.10
PC Network Advisor Issue 91 (January 1998) Page 14
Connectivity:Overview
TCP/IP
a program that supplies information to FTP is unusual compared to other second, LIST, causes the server to open
a requesting client. The information sup- TCP applications in that it uses two the specified port, send the directory
plied usually relates to the user accounts TCP connections. A control connection list, and close it again.
on a host, though many ISPs use Finger is made to the well-known FTP port The sequence for downloading a
servers to provide status information. number 21, and this is used to send FTP file is very similar to that for obtaining
The well-known Finger port is TCP commands and receive replies. A sepa- a directory list. First, a PORT com-
port 79. A Finger client opens this port rate data connection is established mand is used to specify the data con-
and then sends a request, which is whenever a file or other information is nection port, and then the command
either a null string or a user name. The to be transferred, and closed when the “RETR filename” is sent to specify the
server responds by sending some text data transfer has finished. Keeping file to be retrieved. The server opens
and closing the connection. If a null data and commands separate makes the data port and sends the data, which
string was sent you may receive infor- life easier for the client software, and the client writes to the hard disk. The
mation about all users known to the means that the control connection is server closes the TCP connection to the
system; a user name will return infor- always free to send an ABOR (abort) data port when the file transfer has
mation about that specific user. command to terminate a lengthy data finished, which is the signal to the cli-
For security reasons many organi- transfer. ent to close the newly-created file.
sations do not run Finger servers, or FTP commands are sent in plain 7-
have them reply with a standard mes- bit ASCII, and consist of a command of Conclusion
sage whatever the request. From our up to 4 characters followed by zero or
perspective the point of interest is that more parameters (those familiar with Since you are unlikely to be asked
the protocol is pure ASCII text, as you text mode FTP clients like that sup- to write your own client or server there
can verify by connecting to a Finger plied with Microsoft TCP/IP may find is little to be gained from looking at
server using a Telnet client. it curious that FTP commands are not these application protocols in more de-
the same as the commands given to the tail. However, it is hoped that some
File Transfer Protocol FTP client). The replies consist of a useful insights into the working of In-
three digit number followed by an op- ternet applications can be gained from
Telnet allows you to interact with tional text explanation, for example, these brief descriptions of how a few of
an application running on a remote “250 CWD command successful”. The them work.
computer, but it has no facility for ena- numbers are for easy interpretation by Perhaps the most striking thing
bling you to copy a file from that com- FTP client software, the explanations about the protocols that use TCP is
puter’s hard disk to yours, nor for you are for the benefit of the user. how simple they are. Because the
to upload files to the remote system. It is instructive to see what happens lower protocol levels take care of reli-
That function is carried out using File during a simple FTP session. When ability, routing and physical transfer
Transfer Protocol (FTP). you connect to the FTP server (TCP matters, the application protocol need
The FTP specification caters for sev- port 21) it sends its welcome message concern itself only with things relating
eral different file types, structures and prefixed by the numeric code 220. The to the application. This, of course, is the
transfer modes, but in practice FTP im- FTP client prompts you for your user- whole point of using a layered protocol
plementations recognise either text files name, which it then sends using the stack.
or binary files. Text files are converted FTP command “USER username”. The
from their native format to 7-bit ASCII server may respond with “331 Need Click here for the final part
with each line terminated by a car- password for username”. The client of this article
riage-return, line-feed pair for trans- detects this, prompts you for the pass-
mission. They are converted back to word and sends this to the server using
the native text file format by the FTP the command “PASS password”. If the
client. FTP therefore provides a cross- password is correct the client will re-
platform transfer mechanism for text ceive the response “230 Access
files. Binary files are transmitted ex- granted”. PCNA
actly as-is. The next thing you might do is type
Data is transferred as a continuous DIR, to list the current directory on the
stream of bytes. The TCP transport server. This command to the client re-
protocol provides all the reliability, sults in two FTP commands being is-
making sure that data that is lost is sued to the server. The first, “PORT
re-sent and checking that it is received x,x,x,x,y1,y2” tells the server the IP ad-
correctly. It is worth noting that error dress (x.x.x.x) and port number (y1 * The Author
detection uses a simple 16-bit check- 256 + y2) to use for the data connection. Julian Moss is a freelance writer
sum so the probability of undetected The port number is one in the range and software developer. The URL
errors is high compared to a file trans- 1024 to 4999, a range used for ephem- of his Web site is http://www.jm-
fer protocol like Zmodem which uses eral connections (those that are used tech.com/.
a 32-bit CRC. briefly for some specific purpose). The
File: C04100.12
PC Network Advisor Issue 91 (January 1998) Page 16
Recent Reviews from Tech Support Alert