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

📄 rfc1350.ps

📁 this gives details of the network programming
💻 PS
📖 第 1 页 / 共 3 页
字号:
(   bug [4] and other minor document problems was done by Noel Chiappa.) s5 179 M(   This research was supported by the Advanced Research Projects Agency) s5 166 M(   of the Department of Defense and was monitored by the Office of Naval) s5 153 M(   Research under contract number N00014-75-C-0661.) s5 127 M(1. Purpose) s5 101 M(   TFTP is a simple protocol to transfer files, and therefore was named) s5 88 M(   the Trivial File Transfer Protocol or TFTP.  It has been implemented) s5 75 M(   on top of the Internet User Datagram protocol \(UDP or Datagram\) [2]) s5 23 M(Sollins                                                         [Page 1]) s_RS%%Page: (2) 2%%BeginPageSetup_S24 24 translate/pagenum 2 def/fname (/usr/local/share/doc/rfc/Mirrors/ftp.isi.edu/in-notes/rfc1350.txt) def/fdir (/usr/local/share/doc/rfc/Mirrors/ftp.isi.edu/in-notes/) def/ftail (rfc1350.txt) def% User defined strings:/fmodstr (Wed Jul 08 00:00:00 1992) def/pagenumstr (2) def/user_header_p true def/user_header_left_str (RFC1350) def/user_header_center_str (RFC.net) def/user_header_right_str (Page 2 of 11) def%%EndPageSetupdo_header5 751 M(RFC 1350                    TFTP Revision 2                    July 1992) s5 712 M(   so it may be used to move files between machines on different) s5 699 M(   networks implementing UDP.  \(This should not exclude the possibility) s5 686 M(   of implementing TFTP on top of other datagram protocols.\)  It is) s5 673 M(   designed to be small and easy to implement.  Therefore, it lacks most) s5 660 M(   of the features of a regular FTP.  The only thing it can do is read) s5 647 M(   and write files \(or mail\) from/to a remote server.  It cannot list) s5 634 M(   directories, and currently has no provisions for user authentication.) s5 621 M(   In common with other Internet protocols, it passes 8 bit bytes of) s5 608 M(   data.) s5 582 M(   Three modes of transfer are currently supported: netascii \(This is) s5 569 M(   ascii as defined in "USA Standard Code for Information Interchange") s5 556 M(   [1] with the modifications specified in "Telnet Protocol) s5 543 M(   Specification" [3].\)  Note that it is 8 bit ascii.  The term) s5 530 M(   "netascii" will be used throughout this document to mean this) s5 517 M(   particular version of ascii.\); octet \(This replaces the "binary" mode) s5 504 M(   of previous versions of this document.\) raw 8 bit bytes; mail,) s5 491 M(   netascii characters sent to a user rather than a file.  \(The mail) s5 478 M(   mode is obsolete and should not be implemented or used.\)  Additional) s5 465 M(   modes can be defined by pairs of cooperating hosts.) s5 439 M(   Reference [4] \(section 4.2\) should be consulted for further valuable) s5 426 M(   directives and suggestions on TFTP.) s5 400 M(2. Overview of the Protocol) s5 374 M(   Any transfer begins with a request to read or write a file, which) s5 361 M(   also serves to request a connection.  If the server grants the) s5 348 M(   request, the connection is opened and the file is sent in fixed) s5 335 M(   length blocks of 512 bytes.  Each data packet contains one block of) s5 322 M(   data, and must be acknowledged by an acknowledgment packet before the) s5 309 M(   next packet can be sent.  A data packet of less than 512 bytes) s5 296 M(   signals termination of a transfer.  If a packet gets lost in the) s5 283 M(   network, the intended recipient will timeout and may retransmit his) s5 270 M(   last packet \(which may be data or an acknowledgment\), thus causing) s5 257 M(   the sender of the lost packet to retransmit that lost packet.  The) s5 244 M(   sender has to keep just one packet on hand for retransmission, since) s5 231 M(   the lock step acknowledgment guarantees that all older packets have) s5 218 M(   been received.  Notice that both machines involved in a transfer are) s5 205 M(   considered senders and receivers.  One sends data and receives) s5 192 M(   acknowledgments, the other sends acknowledgments and receives data.) s5 166 M(   Most errors cause termination of the connection.  An error is) s5 153 M(   signalled by sending an error packet.  This packet is not) s5 140 M(   acknowledged, and not retransmitted \(i.e., a TFTP server or user may) s5 127 M(   terminate after sending an error message\), so the other end of the) s5 114 M(   connection may not get it.  Therefore timeouts are used to detect) s5 101 M(   such a termination when the error packet has been lost.  Errors are) s5 49 M(Sollins                                                         [Page 2]) s_RS%%Page: (3) 3%%BeginPageSetup_S24 24 translate/pagenum 3 def/fname (/usr/local/share/doc/rfc/Mirrors/ftp.isi.edu/in-notes/rfc1350.txt) def/fdir (/usr/local/share/doc/rfc/Mirrors/ftp.isi.edu/in-notes/) def/ftail (rfc1350.txt) def% User defined strings:/fmodstr (Wed Jul 08 00:00:00 1992) def/pagenumstr (3) def/user_header_p true def/user_header_left_str (RFC1350) def/user_header_center_str (RFC.net) def/user_header_right_str (Page 3 of 11) def%%EndPageSetupdo_header5 751 M(RFC 1350                    TFTP Revision 2                    July 1992) s5 712 M(   caused by three types of events: not being able to satisfy the) s5 699 M(   request \(e.g., file not found, access violation, or no such user\),) s5 686 M(   receiving a packet which cannot be explained by a delay or) s5 673 M(   duplication in the network \(e.g., an incorrectly formed packet\), and) s5 660 M(   losing access to a necessary resource \(e.g., disk full or access) s5 647 M(   denied during a transfer\).) s5 621 M(   TFTP recognizes only one error condition that does not cause) s5 608 M(   termination, the source port of a received packet being incorrect.) s5 595 M(   In this case, an error packet is sent to the originating host.) s5 569 M(   This protocol is very restrictive, in order to simplify) s5 556 M(   implementation.  For example, the fixed length blocks make allocation) s5 543 M(   straight forward, and the lock step acknowledgement provides flow) s5 530 M(   control and eliminates the need to reorder incoming data packets.) s5 504 M(3. Relation to other Protocols) s5 478 M(   As mentioned TFTP is designed to be implemented on top of the) s5 465 M(   Datagram protocol \(UDP\).  Since Datagram is implemented on the) s5 452 M(   Internet protocol, packets will have an Internet header, a Datagram) s5 439 M(   header, and a TFTP header.  Additionally, the packets may have a) s5 426 M(   header \(LNI, ARPA header, etc.\)  to allow them through the local) s5 413 M(   transport medium.  As shown in Figure 3-1, the order of the contents) s5 400 M(   of a packet will be: local medium header, if used, Internet header,) s5 387 M(   Datagram header, TFTP header, followed by the remainder of the TFTP) s5 374 M(   packet.  \(This may or may not be data depending on the type of packet) s5 361 M(   as specified in the TFTP header.\)  TFTP does not specify any of the) s5 348 M(   values in the Internet header.  On the other hand, the source and) s5 335 M(   destination port fields of the Datagram header \(its format is given) s5 322 M(   in the appendix\) are used by TFTP and the length field reflects the) s5 309 M(   size of the TFTP packet.  The transfer identifiers \(TID's\) used by) s5 296 M(   TFTP are passed to the Datagram layer to be used as ports; therefore) s5 283 M(   they must be between 0 and 65,535.  The initialization of TID's is) s5 270 M(   discussed in the section on initial connection protocol.) s5 244 M(   The  TFTP header consists of a 2 byte opcode field which indicates) s5 231 M(   the packet's type \(e.g., DATA, ERROR, etc.\)  These opcodes and  the) s5 218 M(   formats of  the various types of packets are discussed further in the) s5 205 M(   section on TFTP packets.) s5 49 M(Sollins                                                         [Page 3]) s_RS%%Page: (4) 4%%BeginPageSetup_S24 24 translate/pagenum 4 def/fname (/usr/local/share/doc/rfc/Mirrors/ftp.isi.edu/in-notes/rfc1350.txt) def/fdir (/usr/local/share/doc/rfc/Mirrors/ftp.isi.edu/in-notes/) def/ftail (rfc1350.txt) def% User defined strings:/fmodstr (Wed Jul 08 00:00:00 1992) def/pagenumstr (4) def/user_header_p true def/user_header_left_str (RFC1350) def/user_header_center_str (RFC.net) def/user_header_right_str (Page 4 of 11) def%%EndPageSetupdo_header5 751 M(RFC 1350                    TFTP Revision 2                    July 1992) s5 712 M(          ---------------------------------------------------) s5 699 M(         |  Local Medium  |  Internet  |  Datagram  |  TFTP  |) s5 686 M(          ---------------------------------------------------) s5 660 M(                      Figure 3-1: Order of Headers) s5 621 M(4. Initial Connection Protocol) s5 595 M(   A transfer is established by sending a request \(WRQ to write onto a) s5 582 M(   foreign file system, or RRQ to read from it\), and receiving a) s5 569 M(   positive reply, an acknowledgment packet for write, or the first data) s5 556 M(   packet for read.  In general an acknowledgment packet will contain) s5 543 M(   the block number of the data packet being acknowledged.  Each data) s5 530 M(   packet has associated with it a block number; block numbers are) s5 517 M(   consecutive and begin with one.  Since the positive response to a) s5 504 M(   write request is an acknowledgment packet, in this special case the) s5 491 M(   block number will be zero.  \(Normally, since an acknowledgment packet) s5 478 M(   is acknowledging a data packet, the acknowledgment packet will) s5 465 M(   contain the block number of the data packet being acknowledged.\)  If) s5 452 M(   the reply is an error packet, then the request has been denied.) s5 426 M(   In order to create a connection, each end of the connection chooses a) s5 413 M(   TID for itself, to be used for the duration of that connection.  The) s5 400 M(   TID's chosen for a connection should be randomly chosen, so that the) s5 387 M(   probability that the same number is chosen twice in immediate) s5 374 M(   succession is very low.  Every packet has associated with it the two) s5 361 M(   TID's of the ends of the connection, the source TID and the) s5 348 M(   destination TID.  These TID's are handed to the supporting UDP \(or) s5 335 M(   other datagram protocol\) as the source and destination ports.  A) s5 322 M(   requesting host chooses its source TID as described above, and sends) s5 309 M(   its initial request to the known TID 69 decimal \(105 octal\) on the) s5 296 M(   serving host.  The response to the request, under normal operation,) s5 283 M(   uses a TID chosen by the server as its source TID and the TID chosen) s5 270 M(   for the previous message by the requestor as its destination TID.) s5 257 M(   The two chosen TID's are then used for the remainder of the transfer.) s5 231 M(   As an example, the following shows the steps used to establish a) s5 218 M(   connection to write a file.  Note that WRQ, ACK, and DATA are the) s5 205 M(   names of the write request, acknowledgment, and data types of packets) s5 192 M(   respectively.  The appendix contains a similar example for reading a) s5 179 M(   file.) s5 49 M(Sollins                                                         [Page 4]) s_RS%%Page: (5) 5%%BeginPageSetup_S24 24 translate/pagenum 5 def/fname (/usr/local/share/doc/rfc/Mirrors/ftp.isi.edu/in-notes/rfc1350.txt) def/fdir (/usr/local/share/doc/rfc/Mirrors/ftp.isi.edu/in-notes/) def/ftail (rfc1350.txt) def% User defined strings:/fmodstr (Wed Jul 08 00:00:00 1992) def/pagenumstr (5) def/user_header_p true def/user_header_left_str (RFC1350) def/user_header_center_str (RFC.net) def/user_header_right_str (Page 5 of 11) def%%EndPageSetupdo_header5 751 M(RFC 1350                    TFTP Revision 2                    July 1992) s5 712 M(      1. Host A sends  a  "WRQ"  to  host  B  with  source=  A's  TID,) s5 699 M(         destination= 69.) s5 673 M(      2. Host  B  sends  a "ACK" \(with block number= 0\) to host A with) s5 660 M(         source= B's TID, destination= A's TID.) s5 634 M(   At this point the connection has been established and the first data) s5 621 M(   packet can be sent by Host A with a sequence number of 1.  In the) s5 608 M(   next step, and in all succeeding steps, the hosts should make sure) s5 595 M(   that the source TID matches the value that was agreed on in steps 1) s5 582 M(   and 2.  If a source TID does not match, the packet should be) s5 569 M(   discarded as erroneously sent from somewhere else.  An error packet) s5 556 M(   should be sent to the source of the incorrect packet, while not) s5 543 M(   disturbing the transfer.  This can be done only if the TFTP in fact) s5 530 M(   receives a packet with an incorrect TID.  If the supporting protocols) s5 517 M(   do not allow it, this particular error condition will not arise.) s5 491 M(   The following example demonstrates a correct operation of the) s5 478 M(   protocol in which the above situation can occur.  Host A sends a) s5 465 M(   request to host B. Somewhere in the network, the request packet is) s5 452 M(   duplicated, and as a result two acknowledgments are returned to host) s5 439 M(   A, with different TID's chosen on host B in response to the two) s5 426 M(   requests.  When the first response arrives, host A continues the) s5 413 M(   connection.  When the second response to the request arrives, it) s5 400 M(   should be rejected, but there is no reason to terminate the first) s5 387 M(   connection.  Therefore, if different TID's are chosen for the two) s5 374 M(   connections on host B and host A checks the source TID's of the) s5 361 M(   messages it receives, the first connection can be maintained while) s5 348 M(   the second is rejected by returning an error packet.) s5 322 M(5. TFTP Packets) s5 296 M(   TFTP supports five types of packets, all of which have been mentioned) s5 283 M(   above:) s5 257 M(          opcode  operation) s5 244 M(            1     Read request \(RRQ\)) s5 231 M(            2     Write request \(WRQ\)) s5 218 M(            3     Data \(DATA\)) s5 205 M(            4     Acknowledgment \(ACK\)) s5 192 M(            5     Error \(ERROR\)) s5 166 M(   The TFTP header of a packet contains the  opcode  associated  with) s5 153 M(   that packet.) s5 49 M(Sollins                                                         [Page 5]) s_RS%%Page: (6) 6%%BeginPageSetup_S24 24 translate/pagenum 6 def/fname (/usr/local/share/doc/rfc/Mirrors/ftp.isi.edu/in-notes/rfc1350.txt) def/fdir (/usr/local/share/doc/rfc/Mirrors/ftp.isi.edu/in-notes/) def/ftail (rfc1350.txt) def% User defined strings:/fmodstr (Wed Jul 08 00:00:00 1992) def/pagenumstr (6) def/user_header_p true def/user_header_left_str (RFC1350) def/user_header_center_str (RFC.net) def/user_header_right_str (Page 6 of 11) def%%EndPageSetupdo_header5 751 M(RFC 1350                    TFTP Revision 2                    July 1992) s5 712 M(            2 bytes     string    1 byte     string   1 byte) s5 699 M(            ------------------------------------------------) s5 686 M(           | Opcode |  Filename  |   0  |    Mode    |   0  |) s5 673 M(            ------------------------------------------------) s5 647 M(                       Figure 5-1: RRQ/WRQ packet) s5 608 M(   RRQ and WRQ packets \(opcodes 1 and 2 respectively\) have the format) s5 595 M(   shown in Figure 5-1.  The file name is a sequence of bytes in) s5 582 M(   netascii terminated by a zero byte.  The mode field contains the) s5 569 M(   string "netascii", "octet", or "mail" \(or any combination of upper) s5 556 M(   and lower case, such as "NETASCII", NetAscii", etc.\) in netascii) s5 543 M(   indicating the three modes defined in the protocol.  A host which) s5 530 M(   receives netascii mode data must translate the data to its own) s5 517 M(   format.  Octet mode is used to transfer a file that is in the 8-bit) s5 504 M(   format of the machine from which the file is being transferred.  It) s5 491 M(   is assumed that each type of machine has a single 8-bit format that) s5 478 M(   is more common, and that that format is chosen.  For example, on a) s5 465 M(   DEC-20, a 36 bit machine, this is four 8-bit bytes to a word with) s5 452 M(   four bits of breakage.  If a host receives a octet file and then) s5 439 M(   returns it, the returned file must be identical to the original.) s5 426 M(   Mail mode uses the name of a mail recipient in place of a file and) s5 413 M(   must begin with a WRQ.  Otherwise it is identical to netascii mode.) s

⌨️ 快捷键说明

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