File Transfer Protocol Introduction

OSI model

The Open Systems Interconnection (OSI) model (ISO/IEC 7498-1) is a product of the Open Systems Interconnection effort at the International Organization for Standardization. It is a prescription of characterizing and standardizing the functions of a communications system in terms of abstraction layers.

PDU and SDU
Service data unit(SDU) is the unit of data need to be packaged into lower layer. And then the whole package with specified header or footer required by the lower layer named as Protocol data unit(PDU).
Here is the snapshot to show the relationship about SDU and PDU.
(Provied by Wiki)
Layers
According to recommendation X.200, there are seven layers, labeled 1 to 7. Here is the table for each protocol. The FTP is located at application level.

(Provied by site.)

File Transfer Protocol

FTP is a standard network protocol used to transfer files from one host or to another host over a TCP-based network, such as the Internet.
FTP is built on a client-server architecture and uses separate control and data connections between the client and the server
FTP use clear-text for authentication, such passing user password. This common command-line-application is often shipped with most Windows, Linux and Unix operating system. For security transmition, SSH File Transfer Protocol is used instead.
FTP may run in active or passive mode, which determines how the data connection is established.

  • active model means that server recieves the request contained client IP address and arbitary client port and then initialize the data connection
  • passive model means that the client uses the control connection to send a PASV command to the server and then receives a server IP address and server port number from the server, which the client then uses to open a data connection from an arbitrary client port to the server IP address and server port number received.

While transferring data over the network, four data representations can be used:

  • ASCII mode: used for text. Data is converted, if needed, from the sending host's character representation to "8-bit ASCII" before transmission. As a consequence, this mode is inappropriate for files that contain data other than plain text.
  • Image mode (commonly called Binary mode): the sending machine sends each file byte for byte, and the recipient stores the bytestream as it receives it.
  • EBCDIC mode: use for plain text between hosts using the EBCDIC character set. This mode is otherwise like ASCII mode.
  • Local mode: Allows two computers with identical setups to send data in a proprietary format without the need to convert it to ASCII

Data transfer can be done in any of three modes:

  • Stream mode: Data is sent as a continuous stream, relieving FTP from doing any processing. Rather, all processing is left up to TCP. No End-of-file indicator is needed, unless the data is divided into records.
  • Block mode: FTP breaks the data into several blocks (block header, byte count, and data field) and then passes it on to TCP.[4]
  • Compressed mode: Data is compressed using a single algorithm (usually run-length encoding).

 

Reference

FTP Official Document RFC 959
FTP server return codes

你可能感兴趣的:(protocol)