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

📄 rfc1350.4up.ps

📁 this gives details of the network programming
💻 PS
📖 第 1 页 / 共 4 页
字号:
(         |  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_R_RS%%Page: (5-8) 2%%BeginPageSetup_S24 818 translate%Page: (5) 5%BeginPageSetup_S% N-up sub-page 1/40 -392 translate0.490859 dup scale/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_R%Page: (6) 6%BeginPageSetup_S% N-up sub-page 2/4278 -392 translate0.490859 dup scale/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.) s5 400 M(   The mail recipient string should be of the form "username" or) s5 387 M(   "username@hostname".  If the second form is used, it allows the) s5 374 M(   option of mail forwarding by a relay computer.) s5 348 M(   The discussion above assumes that both the sender and recipient are) s5 335 M(   operating in the same mode, but there is no reason that this has to) s5 322 M(   be the case.  For example, one might build a storage server.  There) s5 309 M(   is no reason that such a machine needs to translate netascii into its) s5 296 M(   own form of text.  Rather, the sender might send files in netascii,) s5 283 M(   but the storage server might simply store them without translation in) s5 270 M(   8-bit format.  Another such situation is a problem that currently) s5 257 M(   exists on DEC-20 systems.  Neither netascii nor octet accesses all) s5 244 M(   the bits in a word.  One might create a special mode for such a) s5 231 M(   machine which read all the bits in a word, but in which the receiver) s5 218 M(   stored the information in 8-bit format.  When such a file is) s5 205 M(   retrieved from the storage site, it must be restored to its original) s5 192 M(   form to be useful, so the reverse mode must also be implemented.  The) s5 179 M(   user site will have to remember some information to achieve this.  In) s5 166 M(   both of these examples, the request packets would specify octet mode) s5 153 M(   to the foreign host, but the local host would be in some other mode.) s5 140 M(   No such machine or application specific modes have been specified in) s5 127 M(   TFTP, but one would be compatible with this specification.) s5 101 M(   It is also possible to define other modes for cooperating pairs of) s5 49 M(Sollins                                                         [Page 6]) s_R%Page: (7) 7%BeginPageSetup_S% N-up sub-page 3/40 -794 translate0.490859 dup scale/pagenum 7 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 (7) def/user_header_p true def/user_header_left_str (RFC1350) def/user_header_center_str (RFC.net) def/user_header_right_str (Page 7 of 11) def%%EndPageSetupdo_header5 751 M(RFC 1350                    TFTP Revision 2                    July 1992) s5 712 M(   hosts, although this must be done with care.  There is no requirement) s5 699 M(   that any other hosts implement these.  There is no central authority) s5 686 M(   that will define these modes or assign them names.) s5 647 M(                   2 bytes     2 bytes      n bytes) s5 634 M(                   ----------------------------------) s5 621 M(                  | Opcode |   Block #  |   Data     |) s5 608 M(                   ----------------------------------) s5 582 M(                        Figure 5-2: DATA packet) s5 543 M(   Data is actually transferred in DATA packets depicted in Figure 5-2.) s5 530 M(   DATA packets \(opcode = 3\) have a block number and data field.  The) s5 517 M(   block numbers on data packets begin with one and increase by one for) s5 504 M(   each new block of data.  This restriction allows the program to use a) s5 491 M(   single number to discriminate between new packets and duplicates.) s5 478 M(   The data field is from zero to 512 bytes long.  If it is 512 bytes) s5 465 M(   long, the block is not the last block of data; if it is from zero to) s5 452 M(   511 bytes long, it signals the end of the transfer.  \(See the section) s5 439 M(   on Normal Termination for details.\)) s5 413 M(   All  packets other than duplicate ACK's and those used for) s5 400 M(   termination are acknowledged unless a timeout occurs [4].  Sending a) s5 387 M(   DATA packet is an acknowledgment for the first ACK packet of the) s5 374 M(   previous DATA packet. The WRQ and DATA packets are acknowledged by) s5 361 M(   ACK or ERROR packets, while RRQ) s5 322 M(                         2 bytes     2 bytes) s5 309 M(                         ---------------------) s5 296 M(                        | Opcode |   Block #  |) s5 283 M(                         ---------------------) s5 257 M(                         Figure 5-3: ACK packet) s5 218 M(   and ACK packets are acknowledged by  DATA  or ERROR packets.  Figure) s

⌨️ 快捷键说明

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