Please Whitelist This Site?
I know everyone hates ads. But please understand that I am providing premium content for free that takes hundreds of hours of time to research and write. I don't want to go to a pay-only model like some sites, but when more and more people block ads, I end up working for free. And I have a family to support, just like you. :)
If you like The TCP/IP Guide, please consider the download version. It's priced very economically and you can read all of it in a convenient format without ads.
If you want to use this site for free, I'd be grateful if you could add the site to the whitelist for Adblock. To do so, just open the Adblock menu and select "Disable on tcpipguide.com". Or go to the Tools menu and select "Adblock Plus Preferences...". Then click "Add Filter..." at the bottom, and add this string: "@@||tcpipguide.com^$document". Then just click OK.
Thanks for your understanding!
Sincerely, Charles Kozierok
Author and Publisher, The TCP/IP Guide
|
NOTE: Using software to mass-download the site degrades the server and is prohibited. If you want to read The TCP/IP Guide offline, please consider licensing it. Thank you.
|
|
|
|
TCP Connection Termination
(Page 4 of 4)
Simultaneous Connection Termination
Just as it is possible for the normal
connection establishment process to be changed if two devices decide
to actively OPEN a connection to each other, it is also possible
for two devices to try to terminate a connection simultaneously. This
term simultaneously doesn't mean that they both decide to
shut down at exactly the same timevariances in network delays
mean nothing can be simultaneous on an internetwork anyway. It simply
means that, in the example above, the client decides to shut down and
sends a FIN, but the server sends its own FIN before the
client's FIN shows up at the server. In that case, a different
procedure is followed, as described in Table 155
and Figure 215.
As you can see, the process is much
more symmetric in this case, with both devices transitioning through
the same states. In either case the end result is the same, with the
connection in the CLOSED statemeaning no connection. Each
TCP will make sure all outstanding data is sent to the application,
sometimes referred to as an implied push (see
the description of the push function for an explanation
of this term). The transmission control
blocks (TCBs) established for the connection in both devices are destroyed
when the connection is closed down.
Table 155: TCP Simultaneous Connection Termination Procedure
Client
|
|
|
Server
|
|
|
Start
State
|
Action
|
Transitions
To State
|
Start
State
|
Action
|
Transitions
To State
|
ESTABLISHED
|
Client Close Step #1 Transmit:
The application using TCP signals that the connection is no longer needed.
The TCP on the client sends the next segment with the FIN bit
set, indicating a request to close the connection.
|
FIN-WAIT-1
|
ESTABLISHED
|
Server Close Step #1 Transmit:
Before the server can receive the FIN sent by the client, the
application on the server also signals a close. The server also sends
a FIN.
|
FIN-WAIT-1
|
FIN-WAIT-1
|
Server Close
Step #1 Receive and Step #2 Transmit: The client has sent a FIN
and is waiting for it to be acknowledged. Instead, it receives the FIN
sent by the server. It acknowledges the server's close request with
an ACK and continues to wait for its own ACK.
|
CLOSING
|
FIN-WAIT-1
|
Client Close
Step #1 Receive and Step #2 Transmit: The server has sent a FIN
and is waiting for it to be acknowledged. Instead, it receives the FIN
sent by the client. It acknowledges the client's close request with
an ACK and continues to wait for its own ACK.
|
CLOSING
|
CLOSING
|
Client Close Step #2 Receive:
The client receives the ACK for its FIN.
|
TIME-WAIT
|
CLOSING
|
Server Close Step #2 Receive:
The server receives the ACK for its FIN.
|
TIME-WAIT
|
TIME-WAIT
|
The client
waits for a period of time equal to double the maximum segment life
(MSL) time. This gives enough time to ensure the ACK it sent
to the server was received.
|
|
TIME-WAIT
|
The server
waits for a period of time equal to double the maximum segment life
(MSL) time. This gives enough time to ensure the ACK it sent
to the client was received.
|
|
TIME-WAIT
|
The timer expires after double
the MSL time.
|
CLOSED
|
TIME-WAIT
|
The timer expires after double
the MSL time.
|
CLOSED
|
CLOSED
|
The connection
is closed.
|
|
CLOSED
|
The connection
is closed.
|
|
Figure 215: TCP Simultaneous Connection Termination Procedure Under certain circumstances both devices may decide to terminate a connection simultaneously, or nearly simultaneously. In this case each sends a FIN and before getting an ACK for it, receives the other devices FIN. Each acknowledges the others FIN and waits for a period of time before closing the connection. Note the transition through the CLOSING state, which is only used as part of simultaneous termination.
|
Key Concept: Just as two devices can simultaneously open a TCP session, they can terminate it simultaneously as well. In this case a different state sequence is followed, with each device responding to the others FIN with an ACK, waiting for receipt of its own ACK, and pausing for a period of time to ensure that its ACK is received by the other device before ending the connection. |
If you find The TCP/IP Guide useful, please consider making a small Paypal donation to help the site, using one of the buttons below. You can also donate a custom amount using the far right button (not less than $1 please, or PayPal gets most/all of your money!) In lieu of a larger donation, you may wish to consider purchasing a download license of The TCP/IP Guide. Thanks for your support! |
|
|
Home -
Table Of Contents - Contact Us
The TCP/IP Guide (http://www.TCPIPGuide.com)
Version 3.0 - Version Date: September 20, 2005
© Copyright 2001-2005 Charles M. Kozierok. All Rights Reserved.
Not responsible for any loss resulting from the use of this site.
|