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

📄 rfc783.4up.ps

📁 this gives details of the network programming
💻 PS
📖 第 1 页 / 共 4 页
字号:
(acknowledgment packet, in this special case the  block  number  will  be) s5 140 M(zero.  \(Normally, since an acknowledgment packet is acknowledging a data) s5 114 M(packet,  the  acknowledgment packet will contain the block number of the) s5 88 M(data packet being acknowledged.\)  If the reply is an error packet,  then) s5 49 M(                                 6) s_R%Page: (8) 8%BeginPageSetup_S% N-up sub-page 4/4278 -794 translate0.490859 dup scale/pagenum 8 def/fname (/usr/local/share/doc/rfc/Mirrors/ftp.isi.edu/in-notes/rfc783.txt) def/fdir (/usr/local/share/doc/rfc/Mirrors/ftp.isi.edu/in-notes/) def/ftail (rfc783.txt) def% User defined strings:/fmodstr (Thu Oct 15 00:00:00 1992) def/pagenumstr (8) def/user_header_p true def/user_header_left_str (RFC783) def/user_header_center_str (RFC.net) def/user_header_right_str (Page 8 of 20) def%%EndPageSetupdo_header5 725 M(the request has been denied.) s5 673 M(  In  order to create a connection, each end of the connection chooses a) s5 647 M(TID for itself, to be used for the duration of  that  connection.    The) s5 621 M(TID's  chosen  for  a  connection should be randomly chosen, so that the) s5 595 M(probability that the same number is chosen twice in immediate succession) s5 569 M(is very low.  Every packet has associated with it the two TID's  of  the) s5 543 M(ends  of  the connection, the source TID and the destination TID.  These) s5 517 M(TID's are handed to the supporting UDP \(or other datagram  protocol\)  as) s5 491 M(the  source and destination ports.  A requesting host chooses its source) s5 465 M(TID as described above, and sends its initial request to the  known  TID) s5 439 M(69  decimal  \(105  octal\)  on  the  serving  host.   The response to the) s5 413 M(request, under normal operation, uses a TID chosen by the server as  its) s5 387 M(source  TID and the TID chosen for the previous message by the requestor) s5 361 M(as its destination TID.  The two chosen TID's  are  then  used  for  the) s5 335 M(remainder  of  the  transfer. ) s5 296 M(  As an example, the following shows  the  steps  used  to  establish  a) s5 270 M(connection  to write a file.  Note that WRQ, ACK, and DATA are the names) s5 244 M(of  the  write  request,  acknowledgment,  and  data  types  of  packets) s5 218 M(respectively.    The  appendix  contains a similar example for reading a) s5 192 M(file.) s5 153 M(   1. Host A sends  a  "WRQ"  to  host  B  with  source=  A's  TID,) s5 140 M(      destination= 69.) s5 101 M(   2. Host  B  sends  a "ACK" \(with block number= 0\) to host A with) s5 88 M(      source= B's TID, destination= A's TID.) s5 49 M(                                 7) s_R_RS%%Page: (9-12) 3%%BeginPageSetup_S24 818 translate%Page: (9) 9%BeginPageSetup_S% N-up sub-page 1/40 -392 translate0.490859 dup scale/pagenum 9 def/fname (/usr/local/share/doc/rfc/Mirrors/ftp.isi.edu/in-notes/rfc783.txt) def/fdir (/usr/local/share/doc/rfc/Mirrors/ftp.isi.edu/in-notes/) def/ftail (rfc783.txt) def% User defined strings:/fmodstr (Thu Oct 15 00:00:00 1992) def/pagenumstr (9) def/user_header_p true def/user_header_left_str (RFC783) def/user_header_center_str (RFC.net) def/user_header_right_str (Page 9 of 20) def%%EndPageSetupdo_header5 725 M(At this point the connection has been established  and  the  first  data) s5 699 M(packet  can  be sent by Host A with a sequence number of 1.  In the next) s5 673 M(step, and in all succeeding steps, the hosts should make sure  that  the) s5 647 M(source  TID matches the value that was agreed on in steps 1 and 2.  If a) s5 621 M(source TID does not match, the packet should be discarded as erroneously) s5 595 M(sent from somewhere else.  An error packet should be sent to the  source) s5 569 M(of the incorrect packet, while not disturbing the transfer.) s5 543 M(This  can be  done  only if the  TFTP in fact  receives a packet with an) s5 517 M(incorrect  TID.  If the  supporting  protocols  do  not  allow  it, this) s5 491 M(particular error condition will not arise.) s5 426 M(  The following example demonstrates a correct operation of the protocol) s5 400 M(in  which the above situation can occur.  Host A sends a request to host) s5 374 M(B. Somewhere in the network, the request packet is duplicated, and as  a) s5 348 M(result  two acknowledgments are returned to host A, with different TID's) s5 322 M(chosen on host B in response to  the  two  requests.    When  the  first) s5 296 M(response  arrives,  host  A  continues  the connection.  When the second) s5 270 M(response to the request arrives, it should be rejected, but there is  no) s5 244 M(reason to terminate the first connection.  Therefore, if different TID's) s5 218 M(are  chosen  for  the  two  connections  on host B and host A checks the) s5 192 M(source TID's of the messages it receives, the first  connection  can  be) s5 166 M(maintained while the second is rejected by returning an error packet.) s5 75 M(                                 8) s_R%Page: (10) 10%BeginPageSetup_S% N-up sub-page 2/4278 -392 translate0.490859 dup scale/pagenum 10 def/fname (/usr/local/share/doc/rfc/Mirrors/ftp.isi.edu/in-notes/rfc783.txt) def/fdir (/usr/local/share/doc/rfc/Mirrors/ftp.isi.edu/in-notes/) def/ftail (rfc783.txt) def% User defined strings:/fmodstr (Thu Oct 15 00:00:00 1992) def/pagenumstr (10) def/user_header_p true def/user_header_left_str (RFC783) def/user_header_center_str (RFC.net) def/user_header_right_str (Page 10 of 20) def%%EndPageSetupdo_header5 725 M(5. TFTP Packets) s5 699 M(  TFTP  supports five types of packets, all of which have been mentioned) s5 673 M(above:) s5 634 M(          opcode  operation) s5 621 M(            1     Read request \(RRQ\)) s5 608 M(            2     Write request \(WRQ\)) s5 595 M(            3     Data \(DATA\)) s5 582 M(            4     Acknowledgment \(ACK\)) s5 569 M(            5     Error \(ERROR\)) s5 530 M(The TFTP header of a packet contains the  opcode  associated  with  that) s5 504 M(packet.) s5 478 M(                       Figure 5-1: RRQ/WRQ packet) s5 413 M(            2 bytes     string    1 byte     string   1 byte) s5 400 M(            ------------------------------------------------) s5 387 M(           | Opcode |  Filename  |   0  |    Mode    |   0  |) s5 374 M(            ------------------------------------------------) s5 322 M(  RRQ  and  WRQ  packets  \(opcodes 1 and 2 respectively\) have the format) s5 296 M(shown in Figure 5-1.  The file name is a sequence of bytes  in  netascii) s5 270 M(terminated  by  a  zero  byte.    The  mode  field  contains  the string) s5 244 M("netascii", "octet", or "mail" \(or any comibnation of  upper  and  lower) s5 218 M(case,  such  as  "NETASCII", NetAscii", etc.\) in netascii indicating the) s5 192 M(three modes defined in the protocol.  A  host  which  receives  netascii) s5 166 M(mode data must translate the data to its own format.  Octet mode is used) s5 140 M(to transfer a file that is in the 8-bit format of the machine from which) s5 114 M(the  file is being transferred.  It is assumed that each type of machine) s5 88 M(has a single 8-bit format that is more common, and that that  format  is) s5 49 M(                                 9) s_R%Page: (11) 11%BeginPageSetup_S% N-up sub-page 3/40 -794 translate0.490859 dup scale/pagenum 11 def/fname (/usr/local/share/doc/rfc/Mirrors/ftp.isi.edu/in-notes/rfc783.txt) def/fdir (/usr/local/share/doc/rfc/Mirrors/ftp.isi.edu/in-notes/) def/ftail (rfc783.txt) def% User defined strings:/fmodstr (Thu Oct 15 00:00:00 1992) def/pagenumstr (11) def/user_header_p true def/user_header_left_str (RFC783) def/user_header_center_str (RFC.net) def/user_header_right_str (Page 11 of 20) def%%EndPageSetupdo_header5 725 M(chosen.   For example, on a DEC-20, a 36 bit machine, this is four 8-bit) s5 699 M(bytes to a word with four bits of breakage.  If a host receives a  octet) s5 673 M(file  and  then  returns  it, the returned file must be identical to the) s5 647 M(original.  Mail mode uses the name of a mail recipient  in  place  of  a) s5 621 M(file  and  must begin with a WRQ.  Otherwise it is identical to netascii) s5 595 M(mode.  The mail recipient string should be of  the  form  "username"  or) s5 569 M("username@hostname".    If the second form is used, it allows the option) s5 543 M(of mail forwarding by a relay computer.) s5 491 M(  The discussion above assumes that both the sender  and  recipient  are) s5 465 M(operating  in  the same mode, but there is no reason that this has to be) s5 439 M(the case.  For example, one might build a storage server.  There  is  no) s5 413 M(reason that such a machine needs to translate netascii into its own form) s5 387 M(of  text.    Rather,  the  sender  might send files in netascii, but the) s5 361 M(storage server might simply store  them  without  translation  in  8-bit) s5 335 M(format.    Another  such situation is a problem that currently exists on) s5 309 M(DEC-20 systems.  Neither netascii nor octet accesses all the bits  in  a) s5 283 M(word.  One might create a special mode for such a machine which read all) s5 257 M(the  bits in a word, but in which the receiver stored the information in) s5 231 M(8-bit format.  When such a file is retrieved from the storage  site,  it) s5 205 M(must  be restored to its original form to be useful, so the reverse mode) s5 179 M(must also be implemented.  The user site  will  have  to  remember  some) s5 153 M(information  to  achieve  this.   In both of these examples, the request) s5 127 M(packets would specify octet mode to the foreign host, but the local host) s5 101 M(would be in some other mode.  No such machine  or  application  specific) s5 75 M(modes have been specified in TFTP, but one would be compatible with this) s5 36 M(                                 10) s_R%Page: (12) 12%BeginPageSetup_S% N-up sub-page 4/4278 -794 translate0.490859 dup scale/pagenum 12 def/fname (/usr/local/share/doc/rfc/Mirrors/ftp.isi.edu/in-notes/rfc783.txt) def/fdir (/usr/local/share/doc/rfc/Mirrors/ftp.isi.edu/in-notes/) def/ftail (rfc783.txt) def% User defined strings:/fmodstr (Thu Oct 15 00:00:00 1992) def/pagenumstr (12) def/user_header_p true def/user_header_left_str (RFC783) def/user_header_center_str (RFC.net) def/user_header_right_str (Page 12 of 20) def%%EndPageSetupdo_header5 725 M(specification.) s5 673 M(  It  is  also  possible  to define other modes for cooperating pairs of) s5 647 M(hosts, although this must be done with care.  There  is  no  requirement) s5 621 M(that  any  other  hosts  implement these.  There is no central authority) s5 595 M(that will define these modes or assign them names.) s5 569 M(                        Figure 5-2: DATA packet) s5 504 M(                   2 bytes     2 bytes      n bytes) s5 491 M(                   ----------------------------------) s5 478 M(                  | Opcode |   Block #  |   Data     |) s5 465 M(                   ----------------------------------) s5 413 M(  Data is actually transferred in DATA packets depicted in  Figure  5-2.) s5 387 M(DATA packets \(opcode = 3\) have a block number and data field.  The block) s5 361 M(numbers  on data packets begin with one and increase by one for each new) s5 335 M(block of data.  This restriction allows the  program  to  use  a  single) s5 309 M(number  to  discriminate  between  new packets and duplicates.  The data) s5 283 M(field is from zero to 512 bytes long.  If it  is  512  bytes  long,  the) s5 257 M(block  is  not  the  last block of data; if it is from zero to 511 bytes) s5 231 M(long, it signals the end of the transfer.  \(See the  section  on  Normal) s5 205 M(Termination for details.\)) s5 153 M(  All  packets  other  than  those used for termination are acknowledged) s5 127 M(individually unless a timeout occurs.   Sending  a  DATA  packet  is  an) s5 101 M(acknowledgment  for the ACK packet of the previous DATA packet.  The WRQ) s5 75 M(and DATA packets are acknowledged by ACK or ERROR packets, while RRQ and) s5 36 M(                                 11) s_R_RS%%Page: (13-16) 4%%BeginPageSetup_S24 818 translate%Page: (13) 13%BeginPageSetup_S% N-up sub-page 1/40 -392 translate0.490859 dup scale/pagenum 13 def/fname (/usr/local/share/doc/rfc/Mirrors/ftp.isi.edu/in-notes/rfc783.txt) def/fdir (/usr/local/share/doc/rfc/Mirrors/ftp.isi.edu/in-notes/) def/ftail (rfc783.txt) def% User defined strings:/fmodstr (Thu Oct 15 00:00:00 1992) def/pagenumstr (13) def/user_header_p true def/user_header_left_str (RFC783) def/user_header_center_str (RFC.net) def/user_header_right_str (Page 13 of 20) def%%EndPageSetupdo_header5 725 M(                         Figure 5-3: ACK packet) s5 660 M(                         2 bytes     2 bytes) s5 647 M(                         ---------------------) s

⌨️ 快捷键说明

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