Re: curl timeout vs socket timeout
| From: | Richard Lynch | Date: | Thu, 31 Jan 2008 01:23:44 +0000 |
| Subject: | Re: curl timeout vs socket timeout | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-268397@lists.php.net to get a copy of this message | ||
On Mon, January 28, 2008 3:56 pm, Ravi Menon wrote:
> 1) curl:
>
> .
> .
> curl_setopt( $handle, CURLOPT_TIMEOUT, 1 );
> .
> .
> $resp = curl_exec($handle)
>
>
> 2) sockets:
>
> stream_set_timeout( $sock, 1);
This is only for AFTER you've already opened up the socket.
If you want a timeout on the opening, the setting is in php.ini, or
you can just use ini_set() right before the fsockopen.
> In (1), how is the timeout applied - is it:
>
> a) timeout includes the entire curl_exec() call - the combined socket
> write() ( to send the request ) and
> the read() ( read the response ) calls.
>
> or
>
> b) timeout is independently applied to write() and read() end
> respectively.
>
> Some of our tests seem to indicate it is (a).
You'd probably have to ask the cURL folks...
> In (2), I am assuming the stream timeout is applied at each i/o call
> independently for fwrite() and fread() - I am pretty
> much certain on this as this is how it would map to underlying C
> calls.....
Almost for sure, it applies to any given fwrite/fread.
Actually, probably at an even lower level, to any given packet
sent/received within an fwrite/fread
> It will be good to get a confirmation on our doubts.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?