Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Flow control

Flow control,TCP connection Management,RTT

  • Be the first to comment

  • Be the first to like this

Flow control

  1. 1. TRANSPORT LAYER DONE BY: STEFFY THIRD YEAR CSE -B B.S.ABDUR RAHMAN UNIVERSITY
  2. 2. Contents
  3. 3. TCP Flow Control • Host has a receiver buffer on each side of TCP connection. • Data will be placed in the receive buffer only if the received data is correct. • Application process running on the receiver host will read data from this buffer.
  4. 4. Problem arises…… • Receiving application may be busy with some other work. • Data has to wait for a long time until it is read by application process which is running on host(receiver). • Sender can easily overflow the receiver buffer by sending too much of data quickly. • To overcome this problem ,TCP provides flow control service to its applications.
  5. 5. Continues…. • Flow control is a speed matching service the rate at which sender is sending , against the rate at the receiving application is reading. • TCP provides flow control by having the sender maintain a variable called the receive window. • The receiver window is used to give the sender a number of free buffer space is available at the receiver. • Since TCP is full duplex, sender at each side of the connection will maintains a receiver window.
  6. 6. File Transfer scenario Host A Host B TCP connection Large file Receiver Buffer
  7. 7. • Variables used in this scenario: 1.LastByteRead 2.LastByteRcvd • Receive window is represented by RcvWindow • RcvWindow=RcvBuffer-[LastByteRcvd-LastByteRead] • TCP is not allow the sender to overflow the allocated receiver buffer. • LastByteRcvd-LastByteRead <=RcvBuffer. • Spare room is changes with time, RcvWindow is dynamic.
  8. 8. How RcvWindow is used? • Host B tells Host A no of spare room available in its connection buffer. • By placing the current value of RcvWindow in the receive Window field of every segment it sends to A. • Initially , RcvWindow=RcvBuffer • Host A keep track of two variables: 1.LastByteSent 2.LastByteAcked • LastByteSent - LastByteAcked=No of Unacknowledged data
  9. 9. Continues…. • By keeping the unacknowledged data value less than the value of RcvWindow, Host A ensure that it does not overflow the RcvBuffer at Host B. • LastByteSent-LastByteAcked <= RcvWindow
  10. 10. TCP Connection Management Client Server Client- server scenario :In which process running in one host (client) wants to connects with the process running on the other host (server).
  11. 11. Connection……… • Client application process informs the client TCP that it wants to establish a connection to a process in the server. • Client TCP proceeds to establish a connection with TCP in the server in the following manner.
  12. 12. Establish a connection(1) • Step 1: client TCP send a special segment to server side TCP which does not contains application layer data. • SYN bit in client segment header will be set to 1. • So , this segment is called as SYN segment. • Client chooses an random sequence number(client_isn) and placed this number in the sequence number field of TCP client SYN segment. • This segment is encapsulated with IP datagram and sent to the server.
  13. 13. Establish a connection(2) • Step 2: Once TCP datagram arrives at server host , it extracts the TCP SYN segment from the datagram allocates the TCP buffers and variables to the connection and sends a connection granted segment to the client TCP. • This segment also contains no application data. • It contains 3 important information: 1.SYN bit set to 1 2.Acknowledgement field of TCP segment header is set to client_isn+1. 3.Own sequence number(server_isn) Connection segment is also referred as SYNACK segment.
  14. 14. Establish a connection(3) • Step 3: Once client receives the connection granted segment , client also allocates buffers and variables to the connection. • Client sends a host a another segment which acknowledges the server connection granted segment by putting the server_isn+1(server sequence number)in the acknowledgement field of the TCP segment header. • SYN bit is set to zero , since connection gets established. • In order to establish a connection, three packets are sent between two hosts, Therefore this connection procedure referred as three-way hand shake.
  15. 15. Closing a connection • Step 1: client end system sends TCP FIN set to 1 control segment to server • Step 2: server receives FIN, replies with ACK. Closes connection, sends FIN set to 1. • Step 3: client receives FIN, replies with ACK. Enters “timed wait” -will respond with ACK to received FINs • Step 4: server, receives ACK. Connection closed. Note: At this point ,all resources in the host will be deallocated.
  16. 16. Client Life cycle
  17. 17. Server LifeCycle
  18. 18. RTT Estimation • How to estimate RTT? Sample RTT for a segment is the amount of time between when the segment is sent and when an acknowledgement for the segment is received. • TCP never computes a sample RTT for a segments that has been retransmitted ; it only computes sample RTT for a segment that has been transmitted.
  19. 19. Continues …… • Sample RTT values will be fluctuate from one segment to segment due to congestion in routers. • Because of this fluctuation , some RTT value may be atypical. • So, in order to estimate the typical RTT ,there is a need to take a average of all sample RTT values. • After obtaining new sampleRTT,TCP updates EstimateRTT by • EstimateRTT=(1- α).EstimatedRTT + α.sampleRTT
  20. 20. Continues……. • In the above formula, 1. EstimatedRTT is the weighted combinations of the previous value of estimated RTT and the new value for sample RTT. 2. α=0.125 Formula will be, EstimateRTT=0.875.EstimatedRTT + 0.125.sampleRTT. Now the EstimatedRTT is the weighted average of the sample RTT values. Such an average is called Exponential weighted moving average
  21. 21. RTT: gaia.cs.umass.edu to fantasia.eurecom.fr 100 150 200 250 300 350 1 8 15 22 29 36 43 50 57 64 71 78 85 92 99 106 time (seconnds) RTT(milliseconds) SampleRTT Estimated RTT
  22. 22. Thank you

    Be the first to comment

    Login to see the comments

Flow control,TCP connection Management,RTT

Views

Total views

156

On Slideshare

0

From embeds

0

Number of embeds

0

Actions

Downloads

5

Shares

0

Comments

0

Likes

0

×