TCP Connection Termination

v TCP provides two types of connection terminations i.e. graceful and abrupt termination.
v A graceful termination can be initiated by an application, when it is having no more data to send.
v The TCP entity completes transmission of its data and, upon receiving acknowledgement from the receiver, issues a segment with the FIN bit set.
v Upon receiving the FIN segment, a TCP entity informs its application that other entity has terminated its transmission of data. For example, in below figure,
v The host A terminates its transmission by issuing a FIN segment.
v Host B sends an ACK segment upon receiving the FIN segment from host A.
v After B receives the FIN segment, host B sends 150 bytes of data in one segment, followed by FIN segment.
v Host A sends then sends an acknowledgment.
v Host A enters the TIME_WAIT state and starts TIME_WAIT timer with an initial value=2*MSL.
v If such a FIN segment arrives while host A is the TIME_WAIT state, then the ACK segment is transmitted and the TIME_WAIT timer is restarted at 2MSL.

v When TIME_WAIT timer expires, host A closes the connection.
Figure:- TCP Graceful close
v The second type of termination is an abrupt connection termination through reset (RST) segments.
v If an application decides to terminate a connection abruptly, it issues an ABORT command, which causes TCP to discard any data that is queued for transmission and to send an RST segment.
v The TCP that receives the RST segment then notifies its application process that the connection has been terminated.

0 comments