Re: socket timeout
| From: | Gareth Thomas | Date: | Thu, 05 Dec 2002 17:25:08 +0000 |
| Subject: | Re: socket timeout | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-127175@lists.php.net to get a copy of this message | ||
Hi,
apparently this does not work with socket_read() but only with higher level
socket functions (fread etc). However I have found a function called
socket_set_nonblock(socketname) which apparently does something very
similar, it prevents the socket_read from waiting to receive data. I simply
built my own timeout loop into the code and voila!!
Gareth
"Gareth Thomas" <gdthomas@mercurysoft.com> wrote in message
news:20021205164120.91303.qmail@pb1.pair.com...
> Hi,
>
> I am attempting to timeout a socket_read() that is part of a handshaking
> process using socket_set_timeout(). Problem is it doesn't seem to work at
> all. If I switch of the handshaking write on the server side the read just
> sits there and doesn't time out at all. I have tried
> socket_set_timeout($socket,1) which I believe is 1 second and it never
times
> out...
>
> Any thoughts on this would be most appreciated.
>
> Gareth
>
>