⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rfc354.txt

📁 著名的RFC文档,其中有一些文档是已经翻译成中文的的.
💻 TXT
📖 第 1 页 / 共 4 页
字号:
    3) the socket or byte size specification is changed.    4) any of the TELNET connections are closed.    5) an irrecoverable error condition.    It should be noted that two simultaneous data connections(for send and receive) may exist. It is a server option, however, toclose the data connection after each instance of file transfer.III.B Data Representation and Storage    Data is transferred from a storage device in sending HOST toa storage device in receiving HOST. Often it is necessary to performcertain transformations on the data because data storage representationsin the two systems are different. For example, NVT-ASCII has differentdata storage representations in different systems. PDP-10's generallystore NVT-ASCII as five 7-bit ASCII characters, left justified in a 36bit word. 360's store NVT-ASCII as 8-bit EBCDIC codes. Multics storesNVT-ASCII as four 9-bit characters in a 36-bit word. It may desirable toconvert characters into the standard NVT-ASCII representation whentransmitting text between disimilar systems. The sending and receivingsite would have to perform the necessary transformations between thestandard representation and their internal representations.    A different problem in representation arises whentransmitting binary data (not character codes) between HOST systems withdifferent word length. it is not always clear how the sender should senddata, and the receiver store it. For example, when transmitting 32-bitbytes from a 32-bit word-length system to a 36-bit word-length system,it may be desirable (for reasons of efficiency and usefulness) o storethe 32-bit bytes right justified in a 36-bit word in the latter system.In any case, the user should have the option of specifying datarepresentation and transformation functions. It should be noted that FTPprovides for very limited data types reprentations.  Transformationsdesired beyond this limited capability should be performed by the userdirectly or via the use of the Data Reconfiguration Service (DRS, RFC#138, NIC #6715). Additional representation types may be defined laterif there is a demonstrable need.                                                                [Page 7]The File Transfer Protocol                                  July 8, 1972    Data representations are handled in FTP by a user specifyinga representation type. The type may also specify a fixed transfer bytesize. For example in ASCII and Print File representations, the transferbyte size must be 8 bits. Only in the Image and Local Byterepresentations the byte size specified by the BYTE command is to beused. The following data representation types are currently defined inFTP:1. ASCII            The sender converts data form its internal                    character representation to the standard                    ARPANET ASCII form. The receiver converts                    the data from the standard form to its own                    internal form. The data is transferred in                    the standard form. The transfer byte size                    must be 8 bits. This type would be used for                    transfer of text files. This is be default                    type, and it is recommended that this type be                    implemented by all.2. Image            The sender transforms data from contiguous                    bits to bytes for transfer. The receiver                    transforms the bytes into bits, storing them                    contiguously independent of the byte size                    chosen for data transfer. Typical uses for                    the Image type are transfer of executable                    programs between like machines, and transfer                    of binary (non-text) data. It is recommended                    that this type be implemented by all for some                    byte size preferably including the 8 bit byte                    size.3. Local Byte       This representation allows for efficient                    storage, use, and retrieval of data. The                    mann in which data is to be transformed                    depends on the byte size for data transfer,                    and the particular HOST being used. The                    transformation scheme for different byte size                    is to be well publicized b all server sites.                    This transformation shall be invertible                    (i.e., if a file is stored using a certain                    transfer byte size, an identical file must be                    retrievable using the same byte size and                    representation type). It is the user's                    responsibility to keep track of the                    representation type and byte size used for                    his transfer. Typical uses of the Local Byte                    type are in efficient storage and retrieval                    of files, and transfer of structured binary                                                                [Page 8]The File Transfer Protocol                                  July 8, 1972                    data. This type may be identical to the                    image type for byte size which are integral                    multiples of or factors of the computer word                    length-4. Print File-      The server site will transform the ASCII   ASCII            file in a form suitable for printing at the                    server site. The byte size must be 8 bits.                    The transformation may not be invertible.                    This type is different from ASCII in that                    TABs, FFs and other ASCII format effector                    characters may be replaced by SPs, LFs, and                    other substitute characters. The print file                    conversions are to be well publicized by all                    server sites. This type would be used when                    the file is destined for an ASCII printer.                    This type in some systems may be identical to                    the ASCII type. It is recommended that this                    type be implemented by all.5. EBCDIC Print     The server site will transform the EBCDIC   File             file into a form suitable for printing at the                    server site. The byte size must be 8 bits.                    the transformation may not be invertible.                    This type would be used when the file is                    destined for an EBCDIC printer. Only systems                    which use EBCDIC for their internal character                    representation need accept this type.    It should be noted that a serving HOST need not accept allrepresentation types and/or byte size, but it must inform the user ofthe fact by sending an appropriate reply.III.C File Structure and Transfer Modes    The only file structures supported directly in FTP at thepresent time are record structures. However, the use of recordstructures is not mandatory. A user with no record structure in his fileshould be able to store and retrieve his file at any HOST. A userwishing to transmit a record structured file must send the appropriateFTP 'STRU' command (the default assumption is no record structure). Aserving HOST need not accept record structures, but it must inform theuser of this fact by sending an appropriate reply. Any record structureinformation in the data stream may subsequently be discarded by thereceiver.                                                                [Page 9]The File Transfer Protocol                                  July 8, 1972    All data transfer must end with an EOF. The EOF is definedby the data transfer mode. For files that have record structures, an EORis also defined by the transfer mode. Only the transfer modes andrepresentation type combinations that have EOR defined may be used fortransfer or files with record structures. Records may be of zero lengthbut they must be contained in file boundaries. The relationship betweenfiles and records is heirarchical and an EOF implies an EOR.    The following data transfer modes are defined in FTP:1. Stream           The file is transmitted as a stream of bytes of the                    specified byte size. The EOF is signalled by                    closing the data connection. Any representation                    type and byte size may be used in the stream mode                    but record structures are possible only with the                    ASCII representation type. The convention is that                    the ASCII character CR (Carriage Return, Code 13.)                    followed by LF (Line Feed, Code 10.) Indicates an                    EOR in stream mode and ASCII representation type.                    This is the default mode, and it is recommended                    that this mode be implemented by all.2. Text             The file is ASCII text transmitted as sequence of                    8-bit bytes in the ASCII representation type.                    Record structures are allowed in this mode. The                    EOR and EOF are defined by the presence of special                    "TELNET-control" codes (most significant bit set                    of one) in the data stream. The EOR code is 192                    (octal 300, hex C0). The EOF code os 193 (octal                    301, hex C1). The byte size for transfer is 8                    bits.3. Block            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 file block (EOF),                    last record block (EOR), restart marker (see                    section III.D), or suspect data (i.e. the data                    being transferred is suspected of errors and is                    not reliable). Record structures are allowed in                    this mode, and any representation type or byte                    size may be used. The header consists of integral                    number of bytes whose length is greater than or                    equal to 24 bits. Only the least significant 24                    bits (right-jusified) of header shall have                                                               [Page 10]The File Transfer Protocol                                  July 8, 1972                    information, other must significant bits must be                    zero. Of the 24 bits of header information, the                    16 low order bits shall represent byte count, and                    the 8 high order bits shall represent descriptor                    codes as shown below.                            Integral data bytes > 24                    | Must be Zero  | Descriptor    | Byte Count    |                    | 0 to 231 bits |   8 bits      |    16 bits    |                    The following descriptor codes are assigned:                    Code  Meaning                      0   An ordinary block of data.                      1   End of data block is EOR.                      2   End of data block is EOF.                      3   Suspected errors in data block.                      4   Data block is a restart marker.                    The restart marker is imbedded in the data stream                    as integral number of 8-bit bytes (representing                    printable ASCII characters) right-justified in                    integral number of data bytes greater than 8 bits.                    For example if the byte size is 7 bits, the                    restart marker byte would be one byte                    right-justified per two 7-bit bytes as shown                    below:                      Two 7-bit bytes                    |           | Marker Char|                    |           |    8 bits  |                    For byte size of 16 bits or more, two more                    marker bytes shall be packed right-justified. The                    end of the marker may be delimited by the                    character SP (code 32.). If marker characters do                    no exactly fit an integral byte, the unused                    character slots should contain the ASCII character                    SP (code 32.). For example, to transmit a six                    character marker in a 36-bit byte size, the                    following three 36.bit bytes would be sent:                    |   Zero    |  Descriptor  |               |                    |   12 bits |  code=4      | Byte count=2  |                                                               [Page 11]The File Transfer Protocol                                  July 8, 1972                    |    | Marker  | Marker | Marker | Marker |                    |    | 8 bits  | 8 bits | 8 bits | 8 bits |                    |    | Marker  | Marker | SP     | SP     |                    |    | 8 bits  | 8 bits | 8 bits | 8 bits |4 Hasp              The file is transmitted as a sequence of 8-bit bytes                    in the standard Hasp-compressed data format                    (document to be issued by Bob Braden, UCLA). This                    mode achieves considerable compression of data for                    print files. Record structures are allowed in the                    Hasp mode.III.D Error Recovery and Restart    There is no provision for detecting bits lost or scrambledin data transfer. This issue is perhaps handled best at the NCP levelwhere it benefits most users. However, a restart procedure is providedto protect user from system failures (such as failure of either HOST,FTP-process, or the IMP subnet).    The restart procedure is defined only for the block mode ofdata transfer. It requires the sender of data to insert a special markercode in teh data stream with some marker information. The markerinformation has meaning only to the sender, but must consist ofprintable ASCII characters. The printable ASCII characters are definedto be codes 33. through 126. (i.e., not including codes 0. through 31.and the characters SP and DEL). The marker could represent a bit-count,arecord-count, or any other information by wich a system may identify adata checkpoint. The receiver of data, if it implements the restartprocedure, would then mark the corresponding position of this marker inthe receiving system, and return this information to the user.    In the event of a system failure, the user can restart thedata transfer by identifying the marker point with the FTP restartprocedure. The following examples Illustrate the use of the restartprocedure.    1. When server is the sender of data, the server-FTP processinserts an appropriate marker block in the data stream at a convenientdata point. The user-FTP process receiving the data, marks thecoressponding data point in its file system and conveys the last knownsender and receiver marker information to the user. In the event ofsystem failure, the user or user-FTP process restarts the server at the                                                               [Page 12]The File Transfer Protocol                                  July 8, 1972last server marker by sending a restart command with the server's markercode at its argument.  The restart command is transmitted over theTELNET connection and is immediately followed by the command (such asstore or retrieve) which was being executed when the system failureoccured.    2. When user is the sender of data, the user-FTP processinserts the appropriate marker block in the data stream. The server-FTPprocess receiving the data, marks the corresponding data point in itsfile system. The server does not store this marker but conveys the lastknown sender and receiver marker information to the user over the TELNETconnections by appropriate reply codes. The user or the user-FTP processthen restarts transfer in a manner identical to that described in thefirst example.IV. FILE TRANSFER FUNCTIONS    The TELNET connections on which FTP commands and replies aretransmitted, are initiated by the user-FTP process via an ICP to astandard server socket. FTP commands are then transmitted from user toserver, and replies are transmitted from server to user.  The user filetransfer functions invoive sending the FTP commands, interpreting thereplies received and transferring data over the data connection in thespecified manner. The server file transfer functions involve accepting

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -