Re: Handling "Bad file descriptor" during stream_select()

From: Date: Mon, 28 Mar 2016 16:19:45 +0000
Subject: Re: Handling "Bad file descriptor" during stream_select()
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-91980@lists.php.net to get a copy of this message
On 28 March 2016 at 02:57, Grzegorz Zdanowski <grzegorz129@gmail.com> wrote: > Hello! > > by „gone away“ > I mean some underlying error like forceful close of FD and not a > standard disconnection > of the client. What problem exactly are you trying to solve, and do you have a way of showing the problem that isn't just what looks like a programming mistake? e.g. The following code works fine. The file being closed doesn't affect the filehandle $fileHandle = fopen('foo.txt', 'r+'); unlink('foo.txt'); $data = fread($fileHandle, 20); The following code doesn't work fine. The filehandle being closed, surprisingly enough, makes it not usable any more: $fileHandle = fopen('foo.txt', 'r+'); fclose($fileHandle); $data = fread($fileHandle, 20); or, as the link you sent puts it: > If a connection is closed at client side, and you call select() on the server side socket, > FD_READ will be triggered and recv() will return zero, then you can close the socket at server side. > > The "bad file descriptor" error only happens when you call API on an already closed > socket. So I don't understand what problem you're trying to analyze, other than closed file descriptors are closed. cheers Dan

« previous php.internals (#91980) next »