Trapti Gupta

TCP Timers

Various types of timers are used by the TCP to avoid excessive delay during the transmission of the segment. Some of the TCP timers are timeout timer, time wait timer, keep alive timer, and persistent timer.

Introduction

Various types of TCP timers are used to make sure that excessive delay in the transmission of data is not encountered when communication begins. Most of these timers are delicate and handle issues that are not found immediately at the first analysis of the transmission of data. Look at the below section to learn about how the timer makes sure proper data transfers from one end to another.

Time Out Timer or Retransmission Timer

  • A timeout timer begins when the sender transmits a segment to the receiver.
  • Before expiring the timer, if the ACK is received, then nothing is lost.
  • Otherwise, that particular segment is considered lost and it becomes necessary to retransmit the segment again and restart the timer.
  • It is required to look at the various RTTs to find out how the retransmission timeout interval is being calculated.

Measured RTT(RTTm)

The time needed by the segment to reach the destination and also get acknowledgment, even though the acknowledgment includes another segment also, is known as measured round trip time(RTTm).

Smoothed RTT(RTTs)

The average weight of RTTm is known as smoothed RTT (RTTs). There is a possibility of changes in RTTm and its fluctuation is very high that’s why RTO can not be calculated using a single measurement.

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)

RTTs alone are not used by most implementations. So, for finding the RTO(Retransmission Time Out), RTT deviated also needs to be calculated.

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)

Time Wait Timer

  • Time Wait Timer is one of the TCP timers that is used at the time of connection termination.
  • After transmitting the last ACK for the second FIN, the sender begins the time wait timer and terminates the TCP connection.
  • When the TCP connection is closed, there is a possibility that some datagrams still try to make their way using the internet so that they can access the closed port.
  • The quiet timer is designed so that it can prevent just a closed port from reopening again quickly.
  • Generally, the quiet timer is set to twice the maximum segment lifeline so that it makes sure that all the segments still heading for the port must be terminated.

Keep Alive Timer

  • The keep alive timer is used by the TCP for preventing the long idle connections between the TCPs.
  • Keep alive timer is used in the situation when the client starts a TCP connection for transmitting data to the server, and after some time stops sending the data, then the connection opens forever.
  • Whenever the server hears from the client, the server resets the keep-alive timer for 2 hours.
  • Sometimes the condition occurs when the server does not hear from the client for 2 hours, then 10 probe segments are transmitted by the server to the client.
  • The server transmits these probe segments at a time interval of 75 seconds.
  • After transmitting these segments, if the server does not get any response from the client then it is supposed that the client seems to be down.
  • When the client seems to be down, the connection is discarded by the server automatically.

Persistent Timer

  • The persistent timer is one of the TCP timers used in TCP for dealing with one of the deadlock situations,i.e. zero-window-size deadlock situations.
  • If the other end closes its receiver window, then also it keeps the window size information flowing.
  • Whenever the sender receives an ACK from the receiver side with a zero window size, then it begins the persistent timer.
  • In this situation, when the persistent timer goes off, the sender transmits the special type of segment to the receiver.
  • This special type of segment is commonly known as the probe segment and this special type of segment has only 1 byte of new data.
  • The sequence number of this segment is never acknowledged.
  • This sequence number is also not considered even when calculating the sequence number for the rest data.
  • When the receiver transmits the response to the probe segment, then through this response the window size updates.
  • If it is found that the updated window size is non-zero, then it represents that the data can be transmitted now.
  • And if the size of the updated window is still found to be zero, then the persistent timer needs to be set again and this process continues till we get a non-zero window size.

Conclusion

  • Different types of timers are used by the TCP which are known as TCP timers.
  • TCP uses timers to avoid excessive delays during communication.
  • For dealing with the zero deadlock window problem, TCP used the persistent timer
  • A long idle connection can be prevented using the keep-alive timer.
  • For terminating the connection, TCP uses the time wait timer.
  • For the retransmission of lost segments, the time-out timer or the retransmission timer is used by the TCP.

Author