On Mon, 2002-04-29 at 11:14, Steve Meyers wrote:
> On Sun, 2002-04-28 at 22:43, Jason Greene wrote:
> > In the case of a socket you are selecting on has errored, the socket
> > will show up as readable. You then can perform a socket_read/recv, and
> > you should receive NULL (errored socket), then you can call
> > socket_last_error to receive the errno.
> > 
> Unless I'm just a really bad coder and have no idea what I'm doing, this
> won't help.  I tried using socket_last_error, but it returns the same
> error code whether the socket has no data waiting (remember this is a
> non-blocking socket) or if the socket has died.  I can only tell if it
> is dead by writing to the socket.
> 
> What I'd like to do is just find out if the socket is still alive.

You have to call read/recv or write/send before you call last_error.

You should get FALSE from the return of your read/recv, and
socket_last_error should contain EAGAIN if no data is avail on a
non-blocking socket, ECONRESET if the connection was reset by the
peer(etc..etc..), or you would get "" from the return of the read (0
bytes from recv) which would indicate EOF.

-Jason



> 
> -- 
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, visit: http://www.php.net/unsub.php
> 



-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to