develooper Front page | perl.perl5.porters | Postings from April 2004

Re: [perl #29019] nonblocking read returns EAGAIN at eof

From:
perl5-porters
Date:
April 28, 2004 05:12
Subject:
Re: [perl #29019] nonblocking read returns EAGAIN at eof
Message ID:
c6o730$4eo$1@post.home.lunix
In article <rt-3.0.8-29019-85778.2.718717879414@perl.org>,
	David Muir Sharnoff (via RT) <perlbug-followup@perl.org> writes:
> # New Ticket Created by  David Muir Sharnoff 
> # Please include the string:  [perl #29019]
> # in the subject line of all future correspondence about this issue. 
> # <URL: http://rt.perl.org:80/rt3/Ticket/Display.html?id=29019 >
> 
> 
> 
> This is a bug report for perl from muir@idiom.com,
> generated with the help of perlbug 1.34 running under perl v5.8.3.
> 
> 
> -----------------------------------------------------------------
> [Please enter your report here]
> 
> 
> On a non-blocking socket when there is nothing more
> to read and the other side has closed the connection,
> read() returns undef and sets $! to EAGAIN.
> 
> Unix behavior in this situation is to return zero byte
> and no error.
> 
> I believe perl should follow the Unix behavior.  It's already
> hard enough to detect EOF on non-blocking sockets.
> 
It behaves as expected for me at least (sysread returns 0) (5.8.2 though).
Are you sure you wait until the socket is readable (it takes a little bit
of time for the EOF to propegate) ? Can you provide a demonstration ?



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About