Tag: Persistent Timer

TCP Timers | Time Out Timer | Time Wait Timer

TCP Timers-


Timers used by TCP to avoid excessive delays during communication are called as TCP Timers.


The 4 important timers used by a TCP implementation are-



  1. Time Out Timer
  2. Time Wait Timer
  3. Keep Alive Timer
  4. Persistent Timer


Time Out Timer-


TCP uses a time out timer for retransmission of lost segments.


  • Sender starts a time out timer after transmitting a TCP segment to the receiver.
  • If sender receives an acknowledgement before the timer goes off, it stops the timer.
  • If sender does not receives any acknowledgement and the timer goes off, then TCP Retransmission occurs.
  • Sender retransmits the same segment and resets the timer.
  • The value of time out timer is dynamic and changes with the amount of traffic in the network.
  • Time out timer is also called as Retransmission Timer.


Time Wait Timer-


TCP uses a time wait timer during connection termination.


  • Sender starts the time wait timer after sending the ACK for the second FIN segment.
  • It allows to resend the final acknowledgement if it gets lost.
  • It prevents the just closed port from reopening again quickly to some other application.
  • It ensures that all the segments heading towards the just closed port are discarded.
  • The value of time wait timer is usually set to twice the lifetime of a TCP segment.


Also Read- TCP Connection Termination


Keep Alive Timer-


TCP uses a keep alive timer to prevent long idle TCP connections.


  • Each time server hears from the client, it resets the keep alive timer to 2 hours.
  • If server does not hear from the client for 2 hours, it sends 10 probe segments to the client.
  • These probe segments are sent at a gap of 75 seconds.
  • If server receives no response after sending 10 probe segments, it assumes that the client is down.
  • Then, server terminates the connection automatically.


Persistent Timer-


  • TCP uses a persistent timer to deal with a zero-widow-size deadlock situation.
  • It keeps the window size information flowing even if the other end closes its receiver window.




Consider the following situation-

  • Sender receives an acknowledgment from the receiver with zero window size.
  • This indicates the sender to wait.
  • Later, receiver updates the window size and and sends the segment with the update to the sender.
  • This segment gets lost.
  • Now, both sender and receiver keeps waiting for each other to do something.

To deal with such a situation, TCP uses a persistent timer.


Also Read- Silly Window Syndrome


  • Sender starts the persistent timer on receiving an ACK from the receiver with a zero window size.
  • When persistent timer goes off, sender sends a special segment to the receiver.
  • This special segment is called as probe segment and contains only 1 byte of new data.
  • Response sent by the receiver to the probe segment gives the updated window size.
  • If the updated window size is non-zero, it means data can be sent now.
  • If the updated window size is still zero, the persistent timer is set again and the cycle repeats.


Next Article- Time Out Timer | Computation Algorithms


Get more notes and other study material of Computer Networks.

Watch video lectures by visiting our YouTube channel LearnVidFun.