290 likes | 434 Views
CHAPTER 10 TRANSPORT PROTOCOLS. Tanenbaum: The transport layer is not just another layer. It is the heart of the protocol suite . Interface between applications and the networking facility that enables the applications to request a desired quality of service ( Qos ).
E N D
CHAPTER 10TRANSPORT PROTOCOLS • Tanenbaum: The transport layer is not just another layer. It is the heart of the protocol suite. • Interfacebetweenapplications and the networking facilitythat enables the applications to requesta desired quality of service (Qos). • Policies of transmission and retransmission of data units have a profound impact on the level of congestion in the networking facility.
10.1 TRANSMISSION CONTROL PROTOCOL (TCP) • RFC 793 • Transmission Control Protocols, Sep. 1981.(official definitions of TCP) • RFC 1122 • Requirements of Internet Hosts - Communication Layer, Oct. 1989.(subsequent enhancements and implementation specifications) • Section Contents: Protocol operation Retransmission timing Implementation options
TCP protocol data unit: TCP segment • TCP Header: minimum 20 octets + variable-size Options field • Fields include:
Source port (16 bits) • Destination port (16 bits)
Sequence number (32 bits) • S.N. of the first data octets in this segment • If SYN = 1,this field is Initial Sequence Number (ISN),the first data octets is ISN + 1 • Acknowledge number (32 bits) • S.N. of the next data octets that the receiving TCP entity expects to receive
Data offset (4 bits) • header size (in 16-bit words) • points to the position of the first data octets in this segment • Reserved (6 bits)
Flags (6 bits) • PSH • The sending TCP immediately transmits the “pushed data” in a segment. • The receiving TCP immediatelydelivers the “pushed data” to the user. • URG with Urgent Pointer field • The sending TCP immediately transmits the “urgent data” in a segment, with Urgent Pointer set to the last octets of the “urgent data.” • The receiving TCP signals to the user about the “urgent data.” • It is up to the user to decide what to do with the “urgent data.”
Flags (6 bits) • ACK • indicate that the Acknowledge field is significant. • RST • Reset the connection • SYN • If SYN=1, then the Sequence Number field contains Initial Sequence Number. • Only used in the initial connection request segment. • FIN • No more data from sender
Window (16 bits) • Number of data octets that the receiving TCP is willing to accept.(Receiving window size) • Beginning from the ACK field. • Ex: in the ACK segment, ACK = 1601, Window = 1000means thatit will accept 1000 octets of data,from #1601 to # 2601
Checksum (16 bits) • Used for error detection • At the sending TCP:Calculates the complementof the one’s complement sumof all the octetsin the entire segment and a pseudo header,with Checksum field set to zero initially. • At the receiving TCP:Performs the same calculations.If the result is zero (either all bits are zeros or ones), then the segment is correct.
Options (16 bits) • Since RFC 793, two options have been widely accepted: • Window scale factor • Window field is multiplied by 2Fwhere F = windows scale factor max. of 14 • Only used in initial connection request segment • Timestamp • The sending TCP includes a Timestamp Value. • The responding TCP return the same value in ACK. • The sending TCP may calculate the round-trip time of a connection.
TCP Flow Control • Sliding windows (credit allocation scheme) • in octets, maximum of 216 - 1 = 65535 octets • TX: • 3 pointers - NXT (next octet to be sent) UNA (unacknowledged) Window Edge • When transmitting m octets of data (SN=NXT): NXT NXT + m • When receiving ACK (A=i,W=j): (1) Window Edge UNA + W (2) UNA A
RX: • 3 pointers - NXT (next octet expected to receive) ACK (acknowledge) Window EdgeW = window size • When receiving mi octets of data: NXT NXT + mi W W - mi (buffer for processing) • When buffer increases n octets: W W + n • Window Edge NXT + W • When transmitting ACK (A,W) ACK ACK + mi TX: (A = ACK,W = W)
Effect of Window Size in Performance • W=TCP windows size (octets)R=Data rate (bps) at TCP sourceD=Prapagation delay (seconds) • Before ACK arrives at the source end,2RD bits or RD/4 octets have been transmitted Normalized throughput:
Retransmission Strategy • TCP relies exclusively on positive ACK • Two events trigger ReTx • lost or error segments no ACK is issuedlost ACK no ACK is received • if Timer out ReTx • Two strategies for timer • Fixed timer - unable to respond to changes in network • Adaptive timer - may not be trusted, for • destination TCP needs not ACK immediately • ACK in response to initial or ReTx segments? • Internet condition may change suddenly • No complete solutions.
Static retransmission timer • either too long or too short • Adaptive Retransmission Timer • simple averaging • each term is given equal weight • no difference between distant and recent instances
exponential averaging (by RFC 793)(smoothed round-trip time estimate) • where 0< < 1the more distant instances have less weight,the more rescent instances have greater weight
Retransmission Timer should be set at a value somewhat greater than the estimated round-trip time. • (1) constant (2) proportional (RFC 793) • RFC 793 does not recommend specific values but does list as “example values” the following: between 0.8 and 0.9 between 1.3 and 2.0
User User Accept Send Deliver Sender Receiver • TCP Implementation Policy Options • Send Policy • send immediately • frequent and small transmissions: quick response • wait until a certain amount of data accumulates • infrequent and large transmissions: low overhead in segmentations ACK ReTx
Accept Policy • receive in-order • accept and put in receive buffer • receive out of order • in order: • accept only segments that arrived in order;discard all out-of-order segments. • simple,but increases retransmissions • in windows: • accept all segments within the receive window • reduces retransmissions,but complex in testing, storing, and keeping track of out-of-order data
Deliver Policy • deliver in-order segments immediately • frequent and small deliveries: unnecessary processing in TCP, user, and interrupts • buffer a number of segments before delivery • infrequent and large deliveries: user is not receiving data as promptly as may be desirable.
Retransmission Policy • First only: (decreased traffic - increased delay) (In-window) • one ReTx Timer for the entire queue • if ACK, remove appropriate segments and reset timer • if timer out, ReTx 1st segment in queue and reset timer. • Batch: (decreased delay - increased ReTx )(In-order) • one ReTx Timer for the entire queue • if ACK, remove appropriate segments and reset timer • if timer out, ReTx all segments in queue and reset timer. • Individual: (decreased delay - complex implementation)(In-window) • one ReTx Timer for each segment in the entire queue • if ACK, remove appropriate segments and reset timer • if timer out, ReTx individual segment in queue and reset timer.
Acknowledge Policy • Immediate: • immediately transmit an empty segment containing ACK number • simple, fast responding ACK, reduces unnecessary ReTx • overhead, increases extra ACK transmissions • Cumulative: • wait for an outbound data segment to piggyback ACK • a window timer should be used for long delay • more processing in receiver, andcomplicates the estimating of round-trip time