Skip to main content

Transfer Modes and Data Connection

  1. A comparison of "stream" and "text" modes is in order. The advantages of "stream" mode are:

    1. The receiver need not scan the incoming bytes.
    2. It is usable with all data types.

    The disadvantages are:

    1. The EOF by closing the connection is not reliable.
    2. The EOR by ASCII CRLF is unreliable as the CRLF really may be valid data rather than an EOR. It is an EOR only if the sender and receiver have a prior agreement to that effect.
  2. In the Block mode the protocol states that left-most bits not containing information should be zero. It appears that some sites have difficulty sending null bytes in the beginning of a block. Since it is really not necessary for these bytes to be zero, these bits are now defined to be "don't care" bits.

  3. In the use of block mode it is possible for two or more conditions requiring different descriptor codes (suspected errors and either end of record or end of file) to exist simultaneously. Such a possibility may be handled by sending a separate EOR or EOF block with a zero byte count (this is allowed by the protocol). Also it should be noted that an EOF is an implicit EOR.

  4. It needs to be emphasized again that the user-FTP must "listen" on the data socket prior to sending a command requiring a file transfer. Specifically the user-FTP should not wait for a 255 reply (server data socket) before doing the "listen". (The security check may be come later, as the data connection can be closed if connection is to a socket other than that specified by the 255 reply). Although the protocol suggests that the 255 reply would be sent before making the connection, it does not guarantee that the 255 reply would arrive before the initiating RFC at the user site. The above argument also applies to receiving a a close (NCP-CLS) on the data connection before receiving a reply indicating the reason for the close (note assertion on page 24, paragraph 3, RFC 354).

  5. Although the protocol does not restrict closing or leaving open the data connection in Block and Text modes, it should be emphasized that the closing of the data connection, if it is to be done at all, should be done immediately after the file transfer rather than just after a new transfer command is received. This is because the server and user may have to test whether the data connection is open or not before doing a "listen" or an "init" respectively.

  6. It should be emphasized again that 'Type' supersedes 'Byte', and that the TYPE command should be sent before the BYTE command.

  7. It should be noted that both upper and lower case alphabetic characters are to be treated identically in the command syntax. This applies also to the symbols for type, mode, and structure. For example, 'A' and 'a' both indicate ASCII type.

  8. It should be noted that in the 'LIST' command, the data transfer is over the data connection in type ASCII.

  9. The following reply code is to be added:

454 FTP:  Cannot connect to your data socket.

This is a fail response any of the commands requiring data transfer (including RETR, STOR, APPE, and LIST)