Thursday, 29 December 2011

What is FTP?


INTRODUCTION
PURPOSE : FTP (File Transfer Protocol) is the generic term for a group of computer programs aimed at facilitating the transfer of files or data from one computer to another. It originated in the Massachusetts Institute of Technology (MIT) in the early 1970s when mainframes, dumb terminals and time-sharing were the standard.

FTP
The objectives of FTP are:
1) To promote sharing of files (computer programs and/or data).
2) To encourage indirect or implicit (via programs) use of remote computers.
3) To shield a user from variations in file storage  systems among hosts.
4) To transfer data reliably and efficiently. FTP, though usable directly by user at a terminal, is designed mainly for use by programs.

The attempt in this specification is to satisfy the diverse needs of users of maxi-hosts, mini-hosts, personal workstations, and Tacks, with a simple, and easily implemented protocol design.
HISTORY
FTP has had a long evolution over the years.    0
RFC (Request for comments) 172 provided a user-level oriented protocol for file transfer between host computers (including terminal    IMPs). A revision of this as RFC 265, restated FTP for additional review, while RFC 281 suggested  further changes. The use of a "Set Data Type" transaction was proposed in RFC 294 in January 1982.

By July 1973, considerable changes from the last versions of FTP were made, but the general structure remained the same. RFC 542 was published as a new "official" specification to reflect these changes. However, many implementations based on the older specification were not updated. In 1974, RFCs 607 and 614 continued comments on FTP. RFC 624 proposed further design changes and minor modifications. In 1975, RFC 686 entitled, "Leaving Well Enough Alone", discussed the differences between all of the early and later versions of FTP. RFC 691 presented a minor revision of RFC 686, regarding the subject of print files.

PROBLEMS
The primary problems that the FTP poses to firewalls, NAT devices, and load-balancing devices (all of which will simply be referred to as Ârouting devices and not "routers" since gateway machines generally aren't problematic) are:
1.                  Additional TCP/IP connections are used for data transfers;
2.                  Data connections may be sent to random port numbers;
3.                  Data connections may originate from the server to the client, as well as   originating from the client to the server;
4.                  The control connection is idle while the data transfer takes place on the data connection.


FTP Model
NOTES: 1. The data connection may be used in either direction.
2. The data connection need not exist all of the time.
In the model, the user-protocol interpreter initiates the control connection. The control connection follows the Telnet protocol. At the initiation of the user, standard FTP commands are generated by the user-PI and transmitted to the server process via the control connection. (The user may establish a direct control connection to the server-FTP, from a TAC terminal for example, and generate standard FTP commands independently, bypassing the user-FTP process.) Standard replies are sent from the server-PI to the user-PI over the control connection in response to the commands.
The FTP commands specify the parameters for the data connection (data port, transfer mode, representation type, and structure) and the nature of file system operation (store, retrieve, append, delete, etc.). The user-DTP or its designate should "listen" on the specified data port, and the server initiate the data connection and data transfer in accordance with the specified parameters. It should be noted that the data port need not be in the same host that initiates the FTP commands via the control connection, but the user or the user-FTP process must ensure a "listen" on the specified data port. It ought to also be noted that the data connection may be used for simultaneous sending and receiving.
CONTROL CONNECTION

The communication path between the USER-PI and SERVER-PI for the exchange of commands and replies. This connection follows the Telnet Protocol.
DATA CONNECTION
A full duplex connection over which data is transferred, in a specified mode and type. The data transferred may be a part of a file, an entire file or a number of files. The path may be between a server-DTP and a user-DTP, or between two server-DTPs.
FTP CLIENT COMMANDS

·         GET is used for Retrieve the file from server
·         MGET is used for Retrieve multiple files from server
·         PUT is used for Copy local file to server
·         OPEN is used for Copy multiple local files to server*
·         CLOSE is used for Logoff server
·         LS is used for List files in current remote dir on server
·         LCD is used for Change local directory
·         CD is used for Change remote directory
·         REMOTE HELP is used for Lists commands the server accepts

ACCESS CONTROL COMMANDS

·               USER is used for specify user
·               PASS is used for specify password
·               CWD is used for change directory
·               CDUP is used for change directory to parent
·               QUIT is used for logout

SERVICE COMMANDS

·               RETR   is used for retrieve file
·               STOR is used for send file
·               STOU is used for send file and save as unique
·               APPE is used for send file and append
·               ABOR is used for abort prev. service command
·               PWD is used for print working directory
·               LIST    is used for transfer list of files over data link

FTP REPLIES

Replies to File Transfer Protocol commands are devised to ensure the synchronization of requests and actions in the process of file transfer, and to guarantee that the user process always knows the n state of the Server. Every command must generate at least one reply, although there may be more than one; in the latter case, the multiple replies must be easily distinguished. In addition, some commands occur in sequential groups, such as USER, PASS and ACCT, or RNFR and RNTO. The replies show the existence of an intermediate state if all preceding commands have been successful. A failure at any point in the sequence necessitates the repetition of the entire sequence from the beginning.
RESPONSE CODE :

FTP response codes are 3 digits, with the first 2 digits giving specific information on the type of response, and the final digit revealing the exact nature of the code. example

In 120 a first 2 digits 1 & 2 is use for giving specific information & last is use for helpful the exact nature of the code. &
·         120 is used for server ready in nnn minutes
·         200 is used for command ok
·         230 is used for User logged in, proceed.
·         331 is used for User name okay, need password
·         421 is used for Service not available, closing control connection.
This may be a reply to any command if the service knows it must shut down.
·         530 is used for user is not logged in
·         552 is used for Requested file action aborted.
Exceeded storage allocation (for current directory or dataset).
STREAM MODE

The data is transmitted as a stream of bytes. There is no restriction on the representation type used; record
structures are allowed.
In a record structured file EOR and EOF will each be indicated by a two-byte control code. The first byte of the control code will be all ones, the escape character. The second byte will have the low order bit on and zeros elsewhere for EOR and the second low order bit on for EOF; that is, the byte will have value 1 for EOR and value for EOF. EOR and EOF may be indicated together on the last byte transmitted by turning both low order bits on (i.e., the value 3). If a byte of all ones was intended to be sent as data, it should be repeated in the second byte of the control code. If the structure is a file structure, the EOF is indicated by the sending host closing the data connection and all bytes are data bytes.

BLOCK MODE

The file is transmitted as a series of data blocks preceded by one or more header bytes. The header bytes
contain a count field, and descriptor code. The count field indicates the total length of the data block in bytes, thus marking the beginning of the next data block (there are no filler bits). The descriptor code defines: last block in the file (EOF) last block in the record (EOR), restart marker (see the Section on Error
Recovery and Restart) or suspect data (i.e., the data being transferred is suspected of errors and is not reliable). This last code is NOT intended for error control within FTP.
COMPRESSED MODE

There are three kinds of information to be sent: regular data, sent in a byte string; compressed data, consisting of replications or filler; and control information, sent in a two-byte escape sequence. If n>0 bytes (up to 127) of regular data are sent, these n bytes are preceded by a byte with the left-most bit set to 0 and the right-most 7 bits containing the number n.

CONCLUSION
At last we can say that ftp is a very powerful protocol, Having powerful commands, to transfer files from one To another remote computer through internet

No comments:

Post a Comment