curl timeout problem

This is a discussion on curl timeout problem within the PHP Language forums, part of the PHP Programming Forums category; Hi, I'm having a problem with the cURL library. It doesn't seem to obey the 'timeout' parameters. I ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-26-2007
news
 
Posts: n/a
Default curl timeout problem

Hi,
I'm having a problem with the cURL library.
It doesn't seem to obey the 'timeout' parameters.

I set the CURLOPT_CONNECTTIMEOUT to, say, 1 second,
and CURLOPT_TIMEOUT to whatever value.

Then I'm fetching (via a GET request) some page
from a _nonexistent_ domain - and I have to wait around 4 seconds
for the timeout error to show up. (name lookup error)

So - what's the use of CONNECTTIMEOUT and TIMEOUT?
Why I have to wait 4 seconds, while I set the connect timeout
to 1 second?

TIA, Regards
-news
Reply With Quote
  #2 (permalink)  
Old 04-26-2007
Rik
 
Posts: n/a
Default Re: curl timeout problem

news wrote:
> Hi,
> I'm having a problem with the cURL library.
> It doesn't seem to obey the 'timeout' parameters.
>
> I set the CURLOPT_CONNECTTIMEOUT to, say, 1 second,
> and CURLOPT_TIMEOUT to whatever value.
>
> Then I'm fetching (via a GET request) some page from a _nonexistent_
> domain - and I have to wait around 4 seconds
> for the timeout error to show up. (name lookup error)
>
> So - what's the use of CONNECTTIMEOUT and TIMEOUT?
> Why I have to wait 4 seconds, while I set the connect timeout
> to 1 second?


Well, maybe looking up an ip for the host might not be counted as valid
for the timeout (which might be time to let the server respond, and we
first have to know that server). What happens if you choose a
non-existent ip instead of DNS?

--
Rik Wasmus

Estimated date being able to walk again: 01-05-2007.
Less then a week, hurray!
Reply With Quote
  #3 (permalink)  
Old 04-26-2007
news
 
Posts: n/a
Default Re: curl timeout problem

> Hi,
> I'm having a problem with the cURL library.
> It doesn't seem to obey the 'timeout' parameters.
>
> I set the CURLOPT_CONNECTTIMEOUT to, say, 1 second,
> and CURLOPT_TIMEOUT to whatever value.
>
> Then I'm fetching (via a GET request) some page from a _nonexistent_
> domain - and I have to wait around 4 seconds
> for the timeout error to show up. (name lookup error)
>
> So - what's the use of CONNECTTIMEOUT and TIMEOUT?
> Why I have to wait 4 seconds, while I set the connect timeout
> to 1 second?



Sorry, my mistake.
CURL timeout works fine - the problem was that I've set a fractional
timeout - like 0.4 seconds - then the timeouts were strange.
When I now set it to 1,2 or 3 seconds then it timeouts OK.
Checked for domain lookups and IPs.

So actually the question is, if it's possible to set a fractional timeout.

Regards
-news
Reply With Quote
  #4 (permalink)  
Old 04-27-2007
rahul sinha
 
Posts: n/a
Default Re: curl timeout problem

On Apr 26, 2:55 pm, news <a...@inetia.pl> wrote:
> Hi,
> I'm having a problem with the cURL library.
> It doesn't seem to obey the 'timeout' parameters.

Can you show me the code ..

>
> I set the CURLOPT_CONNECTTIMEOUT to, say, 1 second,
> and CURLOPT_TIMEOUT to whatever value.
>
> Then I'm fetching (via a GET request) some page
> from a _nonexistent_ domain - and I have to wait around 4 seconds
> for the timeout error to show up. (name lookup error)
>
> So - what's the use of CONNECTTIMEOUT and TIMEOUT?
> Why I have to wait 4 seconds, while I set the connect timeout
> to 1 second?
>
> TIA, Regards
> -news



Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 06:11 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0