Received: by oss.sgi.com id ; Mon, 26 Jun 2000 08:16:27 -0700 Received: from minus.inr.ac.ru ([193.233.7.97]:41735 "HELO ms2.inr.ac.ru") by oss.sgi.com with SMTP id ; Mon, 26 Jun 2000 08:16:04 -0700 Received: (from kuznet@localhost) by ms2.inr.ac.ru (8.6.13/ANK) id TAA22206; Mon, 26 Jun 2000 19:15:08 +0400 From: kuznet@ms2.inr.ac.ru Message-Id: <200006261515.TAA22206@ms2.inr.ac.ru> Subject: Re: Fwd: Problem with recv syscall on socket when other side closed connection To: dyp@perchine.com (Denis Perchine) Date: Mon, 26 Jun 2000 19:15:08 +0400 (MSK DST) Cc: davem@redhat.com, ak@muc.de, netdev@oss.sgi.com In-Reply-To: <0006262043000Q.00485@dyp> from "Denis Perchine" at Jun 26, 0 08:40:25 pm X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Sender: owner-netdev@oss.sgi.com Precedence: bulk Return-Path: X-Orcpt: rfc822;netdev-outgoing Content-Length: 687 Lines: 19 Hello! > There's quite strange behavior of the linux kernel when other side closed connection > and we try to read from socket. > Firstly I get -1 and EPIPE in errno. Hmmm... I could not find anywhere in standards or manpages > that recv can return EPIPE. OK... Apparently, your last write() failed and you get asynchronous error notification. What does freebsd return? ECONNRESET? Solaris returns EPIPE as well. And EPIPE really looks as sematically correct code. read() is OK, previous write() failed. > The if I try to continue read I will get the rest of the data which arrived between last read and > connection close... Of course. Do you propose to lose this data? 8) Alexey