Announcement

Collapse
No announcement yet.

Protocol overview

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Protocol overview

    Communication and data transfer
    FTP may run in active or passive mode, which determines how the data connection is established. In both cases, the client creates a TCP control connection from a random unprivileged port N to the FTP server command port 21. In active modes, the client starts listening for incoming data connections on port N+1 from the server (the client sends the FTP command PORT N+1 to inform the server on which port it is listening). In situations where the client is behind a firewall and unable to accept incoming TCP connections, passive mode may be used. In this mode, 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. Both modes were updated in September 1998 to support IPv6. Further changes were introduced to the passive mode at that time, updating it to extended passive mode.
    The server responds over the control connection with three-digit status codes in ASCII with an optional text message. For example "200" (or "200 OK") means that the last command was successful. The numbers represent the code for the response and the optional text represents a human-readable explanation or request (e.g. <Need account for storing file>). An ongoing transfer of file data over the data connection can be aborted using an interrupt message sent over the control connection.
    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, and (again, if necessary) to the receiving host's character representation. 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. (Image mode support has been recommended for all implementations of FTP).
    EBCDIC mode: Used for plain text between hosts using the EBCDIC character set.
    Local mode: Allows two computers with identical setups to send data in a proprietary format without the need to convert it to ASCII.
    For text files, different format control and record structure options are provided. These features were designed to facilitate files containing Telnet or ASA.
    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.
    Compressed mode: Data is compressed using a single algorithm (usually run-length encoding).
Working...
X