From owner-freebsd-net Thu Mar 8 13: 0:12 2001 Delivered-To: freebsd-net@freebsd.org Received: from molly.straylight.com (molly.straylight.com [209.68.199.242]) by hub.freebsd.org (Postfix) with ESMTP id 7F7A037B718 for ; Thu, 8 Mar 2001 13:00:10 -0800 (PST) (envelope-from jonathan@graehl.org) Received: from dickie (case.straylight.com [209.68.199.244]) by molly.straylight.com (8.11.0/8.10.0) with SMTP id f28Kxuw26866; Thu, 8 Mar 2001 12:59:56 -0800 From: "Jonathan Graehl" To: "Wietse Venema" Cc: "Freebsd-Net" Subject: RE: [itojun@iijlab.net: accept(2) behavior with tcp RST right after handshake] Date: Thu, 8 Mar 2001 13:00:14 -0800 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Importance: Normal In-Reply-To: <20010308180048.CC09DBC06D@spike.porcupine.org> Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org > > Data CAN be lost if the TCP connection is RST. It has nothing to > > do with the ordering of accept() with respect to close(). > > Please educate me: how would RST come into this discussion at all? > The client does connect() write() close(), there is no forced > connection termination involved at all. > > Wietse If you set the SO_LINGER socket option, a close() may generate RST and discard socket buffers/TCP state, as opposed to the standard behavior of keeping the data around and resending until the data and the FIN are acknowleged by the other end. I am not sure why this is supposed to be a good idea, though, but obviously, if you set that option, you are unconcerned about data loss, or you have already guarded against it with application-level acknowledgment. Let's agree: it is okay for accept to return an error code indicating the connection has already been terminated, so long as any data sent by the client (such that the client had every indication that it was received) is still available for the acceptor to read. -Jon To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message