Re: non blocking fsockopen
| From: | Richard Lynch | Date: | Thu, 03 Aug 2006 19:28:56 +0000 |
| Subject: | Re: non blocking fsockopen | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-240079@lists.php.net to get a copy of this message | ||
On Fri, July 28, 2006 7:21 am, clive wrote:
> I know in PHP 5 you can use stream_socket_client() and set the flag to
> STREAM_CLIENT_ASYNC_CONNECT|STREAM_CLIENT_CONNECT which opens the
> socket
> in a non blocking mode.
>
> in php 4 you can use fsockopen and then set the socket to non
> blocking.
> The problem with this is that the fsockopen blocks until it creates
> the
> socket or times out.
>
> I want to know if there is a replacement for fsockopen that attempts
> to
> open a socket, but returns immediately instead of blocking or is there
> another way to open a socket in a non blocking mode in PHP 4
There is a php.ini setting for how long the socket blocks connecting,
which you can reset with ini_set to 0.
Or maybe there's a separate setting for "non-blocking"...
Anyway, it's do-able with ini_set on some documented settings in
php.ini is the answer.
I added a Contributor's Note to this effect a couple months ago, but a
Notes Nazi decided it was not worthy of keeping. :-(
--
Like Music?
http://l-i-e.com/artists.htm