TCP Timers | Computer Networks - Computer Science Engineering (CSE) PDF Download

Introduction


​TCP uses several timers to ensure that excessive delays are not encountered during communications. Several of these timers are elegant, handling problems that are not immediately obvious at first analysis. Each of the timers used by TCP is examined in the following sections, which reveal its role in ensuring data is properly sent from one connection to another. 
TCP implementation uses four timers
  • Retransmission Timer: To retransmit lost segments, TCP uses retransmission timeout (RTO). When TCP sends a segment the timer starts and stops when the acknowledgment is received. If the timer expires timeout occurs and the segment is retransmitted. RTO (retransmission timeout is for 1 RTT) to calculate retransmission timeout we first need to calculate the RTT(round trip time).

RTT three types

  • Measured RTT(RTTm): The measured round-trip time for a segment is the time required for the segment to reach the destination and be acknowledged, although the acknowledgement may include other segments.
  • Smoothed RTT(RTTs): It is the weighted average of RTTm. RTTm is likely to change and its fluctuation is so high that a single measurement cannot be used to calculate RTO.

Initially -> No value
After the first measurement -> RTTs=RTTm
After each measurement -> RTTs= (1-t)*RTTs + t*RTTm
Note: t=1/8 (default if not given)

  • Deviated RTT(RTTd): Most implementations do not use RTTs alone so RTT deviated is also calculated to find out RTO.

Initially -> No value

After the first measurement -> RTTd=RTTm/2

After each measurement -> RTTd= (1-k)*RTTd + k*(RTTm-RTTs)

Note: k=1/4 (default if not given)

  • Persistent Timer: To deal with a zero-window-size deadlock situation, TCP uses a persistence timer. When the sending TCP receives an acknowledgment with a window size of zero, it starts a persistence timer. When the persistence timer goes off, the sending TCP sends a special segment called a probe. This segment contains only 1 byte of new data. It has a sequence number, but its sequence number is never acknowledged; it is even ignored in calculating the sequence number for the rest of the data. The probe causes the receiving TCP to resend the acknowledgment which was lost.
  • Keep Alive Timer: A keepalive timer is used to prevent a long idle connection between two TCPs. If a client opens a TCP connection to a server transfers some data and becomes silent the client will crash. In this case, the connection remains open forever. So a keepalive timer is used. Each time the server hears from a client, it resets this timer. The time-out is usually 2 hours. If the server does not hear from the client after 2 hours, it sends a probe segment. If there is no response after 10 probes, each of which is 75 s apart, it assumes that the client is down and terminates the connection.
  • Time Wait Timer: This timer is used during tcp connection termination. The timer starts after sending the last Ack for 2nd FIN and closing the connection.
  • After a TCP connection is closed, it is possible for datagrams that are still making their way through the network to attempt to access the closed port. The quiet timer is intended to prevent the just-closed port from reopening again quickly and receiving these last datagrams.

The quiet timer is usually set to twice the maximum segment lifetime (the same value as the Time-To-Live field in an IP header), ensuring that all segments still heading for the port have been discarded.

The document TCP Timers | Computer Networks - Computer Science Engineering (CSE) is a part of the Computer Science Engineering (CSE) Course Computer Networks.
All you need of Computer Science Engineering (CSE) at this link: Computer Science Engineering (CSE)
21 videos|107 docs|66 tests

Up next

FAQs on TCP Timers - Computer Networks - Computer Science Engineering (CSE)

1. What are TCP timers?
Ans. TCP timers are mechanisms used in the Transmission Control Protocol (TCP) to manage various aspects of the connection, such as retransmissions, acknowledgments, and congestion control. They are used to ensure reliable and efficient data transmission over a network.
2. How do TCP timers work?
Ans. TCP timers work by setting specific durations for different events during a TCP connection. For example, a retransmission timer is started when a segment is sent, and if the corresponding acknowledgment is not received within that time, the segment is retransmitted. Similarly, congestion control timers help adjust the sending rate based on network congestion.
3. What are the main types of TCP timers?
Ans. The main types of TCP timers include the retransmission timer, the persist timer, the keep-alive timer, and the time-wait timer. Each timer serves a different purpose in managing the TCP connection.
4. How are TCP timers set and adjusted?
Ans. TCP timers are initially set based on default values specified in the TCP protocol. However, they can be adjusted dynamically based on network conditions and events. For example, the retransmission timer is typically doubled after each retransmission, allowing for longer timeouts as needed.
5. What happens when a TCP timer expires?
Ans. When a TCP timer expires, it triggers a specific action. For example, if the retransmission timer expires, the TCP sender will retransmit the unacknowledged segment. If the keep-alive timer expires, a keep-alive probe is sent to check if the connection is still active. The appropriate action depends on the type of timer and the current state of the TCP connection.
21 videos|107 docs|66 tests
Download as PDF

Up next

Explore Courses for Computer Science Engineering (CSE) exam
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

Exam

,

Viva Questions

,

ppt

,

past year papers

,

TCP Timers | Computer Networks - Computer Science Engineering (CSE)

,

video lectures

,

study material

,

practice quizzes

,

Extra Questions

,

Previous Year Questions with Solutions

,

MCQs

,

pdf

,

Free

,

shortcuts and tricks

,

Important questions

,

TCP Timers | Computer Networks - Computer Science Engineering (CSE)

,

Objective type Questions

,

Sample Paper

,

TCP Timers | Computer Networks - Computer Science Engineering (CSE)

,

Semester Notes

,

Summary

,

mock tests for examination

;