Friday, January 30, 2015

TCP Timers




TCP uses several timers to ensure that excessive delays are not encountered during communications. 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.



Retransmission Timer

The retransmission timer manages retransmission timeouts (RTOs), which occur when a preset interval between the sending of a datagram and the returning acknowledgment is exceeded. The value of the timeout tends to vary, depending on the network type, to compensate for speed differences. If the timer expires, the datagram is retransmitted with an adjusted RTO, which is usually increased exponentially to a maximum preset limit. If the maximum limit is exceeded, connection failure is assumed and error messages are passed back to the application.

Values for the timeout are determined by measuring the round trip time, or RTT. From experiments, these RTTs are averaged by a formula that develops an expected value, called the smoothed round trip time, or SRTT. This value is then increased to account for unforeseen delays.

Quiet Timer

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. Typically, this can result in a port being unavailable for up to 30 seconds, prompting error messages when other applications attempt to access the port during this interval.

Persistence Timer

The persistence timer handles a fairly rare occurrence. It is conceivable that a receive window will have a value of 0, causing the sending machine to pause transmission. The message to restart sending may be lost, causing an infinite delay. The persistence timer waits a preset time and then sends a 1-byte segment at predetermined intervals to ensure that the receiving machine is still clogged.

The receiving machine will resend the zero window size message after receiving one of these status segments, if it is still backlogged. If the window is open, a message giving the new value is returned and communications resumed.

Keep-Alive Timer and Idle Timer

The keep-alive timer sends an empty packet at regular intervals to ensure that the connection to the other machine is still active. If no response has been received after sending the message, by the time the idle timer has expired, the connection is assumed to be broken. The keep-alive timer value is usually set by an application, with values ranging from 5 to 45 seconds. The idle timer is usually set to 360 seconds.



Leave your comment below


No comments:

Post a Comment