473,407 Members | 2,629 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

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
Apr 26 '07 #1
3 14051
Rik
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!
Apr 26 '07 #2
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
Apr 26 '07 #3
On Apr 26, 2:55 pm, news <a...@inetia.plwrote:
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

Apr 27 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Haluk Durmus | last post by:
Hello I checked out openssl,mm,apr,apr-util,apache 2,curl,libxml and php from cvs. php couse an ERROR I did the following steps:
8
by: mrbog | last post by:
1. In order to make an http (or https) request with PHP, I need to recompile php with cURL. 2. In order to install CURL I have to upgrade my openssl rpm, even though I'm runing a version of...
3
by: Chris Fortune | last post by:
# uname -a Linux stargate.mxc-online.net 2.4.20-021stab022.2.777-smp #1 SMP Wed Jul 28 17:12:37 MSD 2004 i686 i686 i386 GNU/Linux I recompiled PHP with mcrypt, openssl, and curl phpinfo():...
4
by: yawnmoth | last post by:
Is it possible to send http requests with curl but not have curl wait for the response? The reason I ask is because I'd like to code a web app that can sorta start time consuming processes...
4
by: Terry | last post by:
I'm using curl to invoke a php script on the same site/server. It works great, but if I call it again while it's still running, nothing happens. Why? Can that be fixed? Why use curl? To make...
4
by: zorro | last post by:
Hello there, I can't figure out why is it that when i use an array for my postfields it doesn't work : this works curl_setopt($curl, CURLOPT_POSTFIELDS, "clown=bozo" ); this doesn't...
0
by: sebastianrs | last post by:
Hello, I have a serious problem with a script using cURL to access a site using various different proxies. It appears that the PHP script always stops executing if the connection to the proxy...
2
by: shotokan99 | last post by:
hi, i wanted to accomplish these task: 1. from that webservice get a certain set of strings from the header 2. next, generate the image. and these 2 steps will be done at the same time. to...
0
by: Floris | last post by:
I'm using libcurl to download some content from another webpage. For reasons previously unknown to me all calls are very slow to the point of usual timeout. Now i found curl_getinfo() and retrieved...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.