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

From: Denis Perchine (dyp@solo.iis.nsk.su)
Date: Sat Jun 24 2000 - 22:40:04 EST


> > There's quite strange behavior of the linux kernel when other side closed connection
> > and we try to read from socket.
>
> 1) You get a SIGPIPE, and if you don't catch it, you'll get shot
>
> 2) You used the MSG_NOSIGNAL and recv returns -1 (error) and errno
> contains EPIPE. It's in the manual.

In which manual? I do not have it in my man page. Also there's nothing about this
in POSIX.
 
> > Firstly I get -1 and EPIPE in errno. Hmmm... I could not find anywhere in standards or manpages
> > that recv can return EPIPE. OK...
>
> man recv in my case states the EPIPE case..
>
> > The if I try to continue read I will get the rest of the data which arrived between last read and
> > connection close... Very strange logic... Any comments on this.
>
> Indeed strange..

That's why some people do not like linux... Such behavior breaks lots of programs.

-- 
Sincerely Yours,
Denis Perchine

---------------------------------- E-Mail: dyp@perchine.com HomePage: http://www.perchine.com/dyp/ FidoNet: 2:5000/120.5 ----------------------------------

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Jun 26 2000 - 21:00:06 EST