From owner-freebsd-questions@FreeBSD.ORG Mon Mar 21 17:48:34 2005 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A454416A4CE for ; Mon, 21 Mar 2005 17:48:34 +0000 (GMT) Received: from smtpout.mac.com (smtpout.mac.com [17.250.248.97]) by mx1.FreeBSD.org (Postfix) with ESMTP id 621A443D49 for ; Mon, 21 Mar 2005 17:48:34 +0000 (GMT) (envelope-from cswiger@mac.com) Received: from mac.com (smtpin01-en2 [10.13.10.146]) by smtpout.mac.com (Xserve/MantshX 2.0) with ESMTP id j2LHmY3d028590; Mon, 21 Mar 2005 09:48:34 -0800 (PST) Received: from [10.1.1.245] (nfw2.codefab.com [199.103.21.225] (may be forged)) (authenticated bits=0)j2LHmWlH015427; Mon, 21 Mar 2005 09:48:33 -0800 (PST) In-Reply-To: <423F05F2.3010101@web.de> References: <423EFE41.6040805@web.de> <56b90b3668acea792519e1e70a7b837a@mac.com> <423F05F2.3010101@web.de> Mime-Version: 1.0 (Apple Message framework v619.2) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <7c82a2d1780970b84810aefc59bdb295@mac.com> Content-Transfer-Encoding: 7bit From: Charles Swiger Date: Mon, 21 Mar 2005 12:48:31 -0500 To: Robert Gogolok X-Mailer: Apple Mail (2.619.2) cc: freebsd-questions@freebsd.org Subject: Re: FIN_WAIT_2 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Mar 2005 17:48:34 -0000 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