📄 rfc700.txt
字号:
NWG/RFC 700 August 1974NIC 31020INWG Experiments Note 1 A Protocol Experiment Eric R. Mader William W. Plummer Raymond S. TomlinsonI. IntroductionIn early February, 1974 the main line printer on BBN's TENEX systemfailed and it was decided to use the PDP-11 line printer via the ARPANETboth for the direct purpose of obtaining listings and also the indirectpurpose of studying network protocols.II. The Basic ProtocolThe design was based on the protocol described by Cerf and Kahn in INWGNote #39. Familiarity with that document is assumed. The following isa brief sketch of the protocol. Not all features described in thissection have been implemented. See Section VI.At any instant, the sender has two pointers into the stream of bytes tobe sent. Bytes to the left of the LEFT pointer have already been sentand acknowledged. Bytes in the "window" between the LEFT and RIGHTpointers have been sent (zero or more times), but no indication ofsuccessful transmission has been received. Bytes to the right of RIGHTremain to be considered at some time in the future.In operation the sender is constantly sending bytes from the input datastream resulting in the RIGHT pointer advancing. Positiveacknowledgements produced by the receiver cause the LEFT edge of thewindow to move towards the RIGHT edge.LEFT and RIGHT are actually numerical byte positions within the datastream. The low order 16 bits of RIGHT are sent with each message as asequence number so that the receiver can identify which part of the datastream it is receiving in case messages are not received in the sameorder they were transmitted. The receiver has a finite amount of bufferspace available in which it can reassemble an image of the data in thetransmitter's window. The receiver discards any messages which havesequence numbers outside of its buffer area. However, messages to theleft of LEFT must be acknowledged even though they are discarded.Otherwise, a lost ACK would cause the sender to retransmit (and thereceiver ingore) the message indefinitely. Messages received with badchecksums are also discarded.As "good" messages are received, the holes are filled in the receiver'sbuffer and continuous segments at the left edge are passed to thephysical line printer (in our case). The receiver informs the sender of Page 2this action by sending an ACK (acknowledgement) message. This messagespecifies the sequence number of the byte it would like to receive next(the new value of LEFT in the sender) and the current amount of bufferspace it has available (new maximum window width in the sender). Thesender ignores ACK's to the left of LEFT and to the right of RIGHT.Thus, both the sender and receiver are prepared to handle multiplecopies of messages.Failures such as messages with bad checksums, messages lost duringtransmission (data and ACK's), and messages discarded due to sequencesnumbers which were apparently out of range, all manifest themselves tothe sender as a dropped ACK. A dropped ACK will cause the sender's LEFTedge to stop advancing, leaving the unacknowledged message at the leftof the sender's window, and possibly a corresponding hole at the left ofthe receiver's image of the window. Eventually, transmission will ceaseand a (10 second) timeout will trigger in the sender, causingretransmission of all data within the window. Note that at the instantof a timeout, there is no guarantee that the un-ACK'd message will beexactly at the left edge of the window or that it is the onlyunacknowledged message in the window. Retransmissions are likely tocause the receiver to see data that it has seen before, but duplicatemessages will be discarded due to sequence number considerations.III. "Say Again"An extension to the INWN #39 protocol which was implemented was theability to let the receiver force retransmission of the entire window byturning on a flag in any message back to the sender. This is useful incases where the receiver believes that a data message has been droppedand it wants to force retransmission rather than wait for a timeout inthe sender. Clearly, this relies on the network to preserve ordering ofthe messages. Also, it is not useful if the error rate is high becausethe whole window is retransmitted in order to get retransmission of asingle message or two.IV. Establishing an AssociationIn the experiment two flags were used to establish an association. FRST(FiRST flag) was the equivalent of SYN described in INWG Note #39 andserved to identify the first message of an association. This instructedthe receiver to accept the sequence number in the message as adefinition of the starting point of sequence numbers for theassociation.The second flag is a receiver-to-sender flag called HUH which is arequest by the receiver for a definition of the sequence numbers. Uponreceipt of a message containing an HUH, the sender responds by turningon FRST in the next data message. Normally, HUH is sent only if thereceiver had been restarted, or if it is replying to messages on a port Page 3that it knows is not part of an association.V. A ProblemA severe problem uncovered with the protocol was concerned withestablishing an association. If the PDP-11 (receiver) was reloadedwhile the spooler (sender) was running, the first few pages of the datastream were printed about six times before normal operation wasestablished. The cause was traced to the following sequence of actions: 1. The sender would be in a loop, timing out and retransmitting because the receiver had not responded. 2. Upon being restarted, the receiver would see a whole window's worth of messages, and respond to each with an HUH. 3. For each HUH the sender would reset the window and include a FRST flag with the first message in each of the (six) retransmissions. 4. The receiver would see the first message of the first retransmission containing a FRST, accept the sequence number, and print the data from that and the following messages. Then, another message containing the FRST flag would appear and the cycle would repeat (five more times). Note that the ACK's generated in the repetitions were ignored by the sender because they were to the left of the window.As a "cure" for the above the receiver program was modified so thatafter sending an HUH, messages are ignored until one with a FRST flagappears. This solution is unacceptable in general because it leaves thereceiver port useless if either the message containing the HUH or theresponse gets lost in transmission. Although a timeout was used toguard against this, the timeout cannot be trusted because it might causetwo messages with FRST flags to be received -- just the problem which isbeing avoided!An alternate cure which does not depend on the network to be losslesswould be to modify the sender to respond to a HUH by ignoring allmessages for at least a round trip delay time before sending itsresponse containing the FRST flag. This results in having to definewhat this time is. In general this cannot be done when messages canbecome trapped for indefinite amounts of time in network partitions.This will be discussed more fully in a subsequent document. Page 4VI. Features not InvestigatedNone of the programs to date have supported any of the followingfeatures: 1. Window size control. The window size was a constant (2048 bytes). In a future experiment the window size will be varied not only by indications of buffer space in the receiver, but also as a function of estimated transit time. (see below). 2. Reassembly. Since reassembly is conceptually easy, it is likely to be one of the first extensions. A message corrupter will be included in the receiver to test the functioning of the reassembly mechanism. 3. Expanded Internetwork Addresses 4. Multiple Associations 5. Reliable Making and Breaking of AssociationsVII. Implementations NotesThe sender involves approximately ten pages of assembly code for thenetwork message interface. Two processes are involved: one which fillsa buffer by reading the input data stream, and a second process whichsends network messages from the buffer and processes replies from thereceiver. The two processes are joined by a coroutine mechanism, but inthe future will be two parallel TENEX processes.The receiver program consists of approximately four pages of BCPL codein addition to IO device drivers and routines which implement queueingprimitives.Each message contained between zero and 255 bytes of data arranged (as acoding convenience) in a way which is directly compatible with the BCPLstring handling routines. Messages contained a single byte of checksumwhich was the low eight bits of the twos complement negation of the twoscomplement sum of all other bytes in the message. We recommend thatsome more reliable checksum function be employed in the future; evenusing eight-bit ones complement arithmetic would be better.Source files for the various programs are available from the authors atBolt Beranek and Newman, 50 Moulton Street, Cambridge Mass., 02138. Page 5VIII. Simple Rate CalculationsIf we assume that an active association has reached steady state, thatprocessing delays are lumped into the transit time T, and that there areno errors, then the maximum data rate may be calculated as follows.Assume the sequence numbers being passed by the RIGHT pointer are somefunction of time, R(t). Messages received by the receiver will be thesame function of time but delayed T (a transit time) seconds. Sinceprocessing time is zero, the acknowledgments will bear this samefunction, R(t-T). Acknowlegements received by the sender will havesequence numbers R(t-2T).Acknowledgements at the sender determine the LEFT pointer, L(t). Also,it is known that R(t) is ahead of L(t) by the width of the window whichis a constant in steady state. Thus, we have the two relations: L(t) = R(t-2T) L(t) = R(t) - WNow, let R(t) = Bt, i.e., sequence numbers are increasing linearly withtime. (Microscopically, short bursts will alternate with longer periodsof inactivity, but the average bandwidth will be B.) The result underthe assumptions is that the bandwidth is: B = W/2T .That is, the bandwidth in bytes per second is just the steady statewindow width divided by the round trip delay time. Conversely, the aboerelation can be determine the buffer sized needed: in oreder for theereceiver to guarantee to accept information that was transmitted, itmust supply buffering equal to (or greater than) the window size. Thewindow size must be equal to or greater than the desired bandwidth timesthe round-trip delay time, i.e. equal to the number of messages in around-trip "pipeline".The bandwidth in the presence of a relatively low error rate may becalculated. Assume that B and W are expressed in terms of (full)messages rather than byte numbers. Each error has two effects: a timeout delay of D seconds and retransmission of W messages. So, the timeQ(M,N) required to transmit M messages burdened by N errors is the sumof the time to transmit the data once, N*D seconds of time out delay,and the time to transmit the window N more times. Q(M,N) = (2T/W)*M + N*D + N*2TDividing by M to get time per message and multiplying the last term by(W/W): Q(M,N)/M = (2T/W) + (N/M)*D + (2T/W)*(N/M)*W .But (M/N) is just the fraction of messages in error. Call this E. Page 6 Q(E) = (2T/W)*(1 + EW) + ED B(E) = 1/[(2T/W)(1+EW) + ED]The advantage to using the "say again" mechanism (Section III.) can nowbe seen: it forces D to be zero, allowing a reasonable average data ratein the presence of errors. Note the effect of a 10 second time out on anetwork with an E of 0.01, assuming W to be 20 messages and T of 0.5second. B(D=10) is 6.7, but with forced retransmission, B(D=0) is 20.IX. A Sequence Number ConsiderationIn order to reject duplicate messages, sequence numbers must contain asufficient number of bits such that it is impossible to cycle throughmore than half the sequence number space in a message lifetime atmaximum transmission rate. Assuming a 1 MegaByte per second network anda maximum lifetime of 500 seconds, the sequence number field of eachmessage must be capable of holding the number 2*500*10**6 which is 10**9or about 2**30. Thus, a 32-bit (4-byte) sequence number field isrecommended.X. Additional Control FunctionsIn response to an attempt to establish an association (SYN) it is feltthat the receiver should be able to deny the attempt (RELease) in one ofthe following three ways: REJECT. (I'm busy. Try again later.) ABORT. (I don't understand what you are sending. (Bad port, etc.)) ABNORMAL (SYN arrived on a established connection.) (Receiver breaks connection and issues this REL.)During an established association, the sender should be able to RELeasethe association in either of these ways: DONE. (I'm done sending to you.) GAG. (Stop. You are sending garbage (ACK's).)These may be coded as combinations of bits in the FLAGS which areconvenient for programming.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -