netdev
[Top] [All Lists]

Re: Fwd: Problem with recv syscall on socket when other side closed conn

To: dyp@xxxxxxxxxxxx (Denis Perchine)
Subject: Re: Fwd: Problem with recv syscall on socket when other side closed connection
From: kuznet@xxxxxxxxxxxxx
Date: Mon, 26 Jun 2000 19:15:08 +0400 (MSK DST)
Cc: davem@xxxxxxxxxx, ak@xxxxxx, netdev@xxxxxxxxxxx
In-reply-to: <0006262043000Q.00485@dyp> from "Denis Perchine" at Jun 26, 0 08:40:25 pm
Sender: owner-netdev@xxxxxxxxxxx
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

<Prev in Thread] Current Thread [Next in Thread>