Re: Socket_connect() timeout
| From: | Chris Shiflett | Date: | Mon, 16 Dec 2002 19:51:17 +0000 |
| Subject: | Re: Socket_connect() timeout | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-128469@lists.php.net to get a copy of this message | ||
--- Max Clark <max@clarksys.com> wrote:
> Warning: socket_connect() unable to connect [60]:
> Operation timed out in
> /usr/home/maxc/public_html/admin/functions.inc on line 66
>
> Is there any way to time out this function? I only want
> to wait 5 seconds.
Now that you mention it, I am not aware of any way to
override that timeout setting. The socket extension is
still experimental, I believe, with hopes of changing its
status soon. Perhaps this is something someone is working
on.
As a possible way around this, could you possible solve
your problem by opening a socket as a virtual file pointer
instead? For example, this would only wait 5 seconds for a
connection:
$fp=fsockopen($host, $port, $err_num, $err_message, "5");
You can treat $fp like any other file pointer, so it is
actually a pretty convenient way to read/write to sockets.
Hope that helps.
Chris