Re: curl timeout vs socket timeout
| From: | Jim Lucas | Date: | Mon, 28 Jan 2008 22:19:02 +0000 |
| Subject: | Re: curl timeout vs socket timeout | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-268235@lists.php.net to get a copy of this message | ||
Ravi Menon wrote:
Hi, We have two versions of client code, one using curl, and other one using raw sockets via fsockopen(), and we use the following code to set the i/o timeouts: 1) curl: . . curl_setopt( $handle, CURLOPT_TIMEOUT, 1 );From the manual CURLOPT_TIMEOUT The maximum number of seconds to allow cURL functions to execute. Notice: "functions", I would take this as the entire process.
. . $resp = curl_exec($handle) 2) sockets: stream_set_timeout( $sock, 1);From the manual Set timeout period on a stream This would tell me that it is on the entire process, not just one function call like fwrite() or fread().
Here we use frwrite() and fread() to send the request and read the response respectively. 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 ) andTrue for boththe read() ( read the response ) calls.or
b) timeout is independently applied to write() and read() end respectively.False for both
Some of our tests seem to indicate it is (a). 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..... It will be good to get a confirmation on our doubts. Thanks, RaviThis is what I have experienced at least. -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare