FIN_WAIT_2
Charles Swiger
cswiger at mac.com
Mon Mar 21 09:48:34 PST 2005
On Mar 21, 2005, at 12:35 PM, Robert Gogolok wrote:
> Charles Swiger wrote:
>> The TCP stack wants the remote end to acknowledge the last FIN it
>> sends and close the connection cleanly, and there is a timer (2 *
>> MSL?) which gets started when a connection moves into the closing
>> stages (FIN_WAIT_1, FIN_WAIT_2, LAST_ACK).
>
> So FIN_WAIT_2 is the time the server waits to receive the FIN from the
> client, but although it doesn't get this last FIN message yet, it
> sends ACK's for the expected FIN message?
FIN_WAIT_2 is a name describing the state of a TCP connection. It's
defined in a state diagram in RFC-793. But otherwise, your description
is pretty good:
[ ... ]
| CLOSE +---------+
| ------- | ESTAB |
| snd FIN +---------+
| CLOSE | | rcv FIN
V ------- | | -------
+---------+ snd FIN / \ snd ACK +---------+
| FIN |<----------------- ------------------>| CLOSE |
| WAIT-1 |------------------ | WAIT |
+---------+ rcv FIN \ +---------+
| rcv ACK of FIN ------- | CLOSE |
| -------------- snd ACK | ------- |
V x V snd FIN V
+---------+ +---------+ +---------+
|FINWAIT-2| | CLOSING | | LAST-ACK|
+---------+ +---------+ +---------+
| rcv ACK of FIN | rcv ACK of FIN |
| rcv FIN -------------- | Timeout=2MSL -------------- |
| ------- x V ------------ x V
\ snd ACK +---------+delete TCB +---------+
------------------------>|TIME WAIT|------------------>| CLOSED |
+---------+ +---------+
TCP Connection State Diagram
Figure 6.
>> It's not uncommon for some clients (think dialup users running
>> Win98), to drop the connection rather rather than close it properly.
> So the client has time to ACK the server's FIN, but the user closes
> the dialup connection, so the application hasn't sent the FIN?
Your http server answers the HTTP request, and tries to close the
connection. It sends a the data, followed by a FIN. It is waiting to
receive an ACK of the FIN, and then receive a FIN from the client
indicating that the client has no more data to send and is willing to
close the connection.
--
-Chuck
More information about the freebsd-questions
mailing list