Received: by oss.sgi.com id ; Mon, 26 Jun 2000 18:40:51 -0700 Received: from pizda.ninka.net ([216.101.162.242]:31108 "EHLO pizda.ninka.net") by oss.sgi.com with ESMTP id ; Mon, 26 Jun 2000 18:40:31 -0700 Received: (from davem@localhost) by pizda.ninka.net (8.9.3/8.9.3) id SAA03319; Mon, 26 Jun 2000 18:31:08 -0700 Date: Mon, 26 Jun 2000 18:31:08 -0700 Message-Id: <200006270131.SAA03319@pizda.ninka.net> X-Authentication-Warning: pizda.ninka.net: davem set sender to davem@redhat.com using -f From: "David S. Miller" To: dyp@perchine.com CC: kuznet@ms2.inr.ac.ru, dyp@perchine.com, ak@muc.de, netdev@oss.sgi.com In-reply-to: <0006270823180R.00485@dyp> (message from Denis Perchine on Tue, 27 Jun 2000 08:19:15 +0700) Subject: Re: Fwd: Problem with recv syscall on socket when other side closed connection References: <200006261515.TAA22206@ms2.inr.ac.ru> <0006270823180R.00485@dyp> Sender: owner-netdev@oss.sgi.com Precedence: bulk Return-Path: X-Orcpt: rfc822;netdev-outgoing Content-Length: 906 Lines: 21 From: Denis Perchine Date: Tue, 27 Jun 2000 08:19:15 +0700 Usual way of handling connection reset when you do only read is to give all data available and then return 0, indicating EOF. Or some OSes (HPUX if I'm not mistaken) gives you all data available and then ECONNRESET. But not other way around... Connection reset effectively means that TCP's reliable data transport has been completely compromised, and therefore any attempt to move data across that socket should immediately indicate an error. What I am also trying to say is that when one says "all the data available", the rest of the connection has in effect dropped all meaning to that phrase, you no longer know what "all the data" is and between two different reset occurances "all the data" will be different so why would you want to read any of it at all? Later, David S. Miller davem@redhat.com